Question

I have a project in which the maven-enforcer rule fails with a multi-module build using non-unique snapshots (which are annoyingly the only kind of snapshot supported in Maven 3).

For example, assume -> is a "depends on" relationship, and:

  1. Module-A -> Module-B -> Module-C
  2. Module-A -> Module-C

and that Module B and Module C are present in the snapshot repository as unique builds. All declared Module versions in the POM are currently 1.0-SNAPSHOT.

Now, building Module A fails:

mvn -pl Module-A install

results in:

[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce) @ Module-A ---
[ERROR] 
Dependency convergence error for com.vivosys.project:Module-C:1.0-SNAPSHOT paths to dependency are:
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
  +-com.vivosys.project:Module-B:1.0-20111228.032527-8
    +-com.vivosys.project:Module-C:1.0-SNAPSHOT
and
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
  +-com.vivosys.project:Module-C:1.0-20111228.032527-6

The transitive dependency is resolved as a non-unique snapshot build, but the direct dependency is resolved as a unique snapshot build.

I am using maven 3.0.3, maven-enforcer 1.0.1. The repository is Artifactory 2.4.2 using the unique snapshots option (as recommended by Artifactory since Maven 3 no longer supports non-unique snapshots).

Solutions?

Update: Looks like artifactory allows overriding the maven client behavior and storing the non-unique snapshot in the repository. However, for some reason Artifactory does not recommend this (see the "Maven 3" blurb at http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories) so other solutions are still welcome.

Was it helpful?

Solution

This bug has been fixed (MENFORCER-118) and released in version 1.1.

OTHER TIPS

You have hit this enforcer plugin bug (raised as enhancement).

Perhaps, strictly as a workaround you can explicitly declare the transitive dependency C as a dependency of A?

The only solution available until MENFORCER-118 is resolved appears to be to configure the repository server to use non-unique snaphots. In Artifactory, this can be done via: Admin, Repositories, select the snapshot repository and choose Edit. Then select Nonunique under Maven Snapshot Version Behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top