Unique Maven Snapshots and Dependency Convergence

I have a project in which the maven-enforcer rule crashes using a multi-module build using non-unique snapshots (which annoyingly only apply to a snapshot supported in Maven 3).

For example, suppose that → is a "depends on" relationship and:

  • Module-A → Module-B → Module-C
  • Module-A → Module-C

and that module B and module C are present in the snapshot store as unique assemblies. All announced versions of modules in POM are currently 1.0-SNAPSHOT.

Now the assembly module A fails:

mvn -pl Module-A install

leads to:

 [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 

Transit dependency is allowed as not a unique assembly of snapshots, but direct dependence is allowed as a unique assembly of snapshots.

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

Solutions?

Refresh . Looks like artifactory allows you to override the behavior of the maven client and save the unhistorical snapshot to the repository. However, for some reason, Artifactory does not recommend this (see "Maven 3" at http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories ), so other solutions are still welcome.

+4
source share
3 answers

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

+4
source

You have removed this plugin error (upgraded as upgrade).

Perhaps strictly as a workaround, you can explicitly declare a transitive dependence of C as a dependence on A?

+2
source

The only solution available before MENFORCER-118 seems to be to configure the warehouse server to use non-specific snapshots. In Artifactory, this can be done using: Admin, Repositories , select a snapshot repository and select Edit . Then select Nonunique in the Maven Snapshot Version Behavior section.

+1
source

Source: https://habr.com/ru/post/1388386/


All Articles