Skip to content

Maven local resolver with parent POM #1616

@charlessimpson

Description

@charlessimpson

Somewhere between 0.13.5 and 0.13.6, the Maven local resolver stopped being able to resolve parent POM's from Maven projects.

If I have a parent pom:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>example-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

</project>

a child pom:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.example</groupId>
        <artifactId>example-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <groupId>com.example</groupId>
    <artifactId>example-child</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

</project>

both of which are installed to my local M2 repo using mvn install. The following build.sbt works in 0.13.5:

name := "example-sbt"

version := "1.0-SNAPSHOT"

libraryDependencies += "com.example" % "example-child" % "1.0-SNAPSHOT"

resolvers += Resolver.mavenLocal

but fails in 0.13.6 with the error:

<snip>

[info] Updating {file:/Users/csimpson/Desktop/sbt-mvn-parent/sbt/}sbt...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.example#example-child;1.0-SNAPSHOT:  Maven2 Local: no ivy file nor artifact found for com.example#example-parent;1.0-SNAPSHOT
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.example:example-child:1.0-SNAPSHOT (/Users/csimpson/Desktop/sbt-mvn-parent/sbt/build.sbt#L5-6)
[warn]        +- example-sbt:example-sbt_2.10:1.0-SNAPSHOT
sbt.ResolveException: unresolved dependency: com.example#example-child;1.0-SNAPSHOT:    Maven2 Local: no ivy file nor artifact found for com.example#example-parent;1.0-SNAPSHOT

<snip>

It might be an issue with Ivy caching, since if I run SBT 0.13.5 first, then 0.13.6 will succeed, but if I delete ~/.ivy2/cache/com.example, then 0.13.6 fails to resolve again. I've verified that Maven is able to resolve the parent POM when depending on the child and that SBT is able to resolve Maven artifacts that don't have a parent POM.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions