Closed pzygielo closed 3 years ago
probably connected with #43
probably connected with #43
Could be. It seems the issue happens after https://github.com/apache/maven-enforcer/commit/ca40308fd58c45e638a35768b3966b5680d4c60e
Yes I'm aware about that, working on it but it take time
Other rules like enforceBytecodeVersion fail with the same. Will update the title/summary.
Is this commit should resolve it ... https://github.com/mojohaus/extra-enforcer-rules/commit/c2d6c56c7888bc11363a18ba62e3b662f9799b3
Is this commit should resolve it ... c2d6c56
But current master (98f6819) + m-e-p/3.0.0 gives
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0:enforce (enforce-on-test) on project cade: Execution enforce-on-test of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0:enforce failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-enforcer-plugin:3.0.0:enforce: java.lang.NoSuchMethodError: org.apache.maven.shared.dependency.graph.DependencyGraphBuilder.buildDependencyGraph(Lorg/apache/maven/project/MavenProject;Lorg/apache/maven/artifact/resolver/filter/ArtifactFilter;)Lorg/apache/maven/shared/dependency/graph/DependencyNode;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-enforcer-plugin:3.0.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/piotr/projects/apache/repo/org/apache/maven/plugins/maven-enforcer-plugin/3.0.0/maven-enforcer-plugin-3.0.0.jar
[ERROR] urls[1] = file:/home/piotr/projects/apache/repo/org/codehaus/mojo/extra-enforcer-rules/1.4-SNAPSHOT/extra-enforcer-rules-1.4-SNAPSHOT.jar
[ERROR] urls[2] = file:/home/piotr/projects/apache/repo/org/apache/maven/shared/maven-dependency-tree/3.1.0/maven-dependency-tree-3.1.0.jar
[ERROR] urls[3] = file:/home/piotr/projects/apache/repo/junit/junit/4.13.2/junit-4.13.2.jar
[ERROR] urls[4] = file:/home/piotr/projects/apache/repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] urls[5] = file:/home/piotr/projects/apache/repo/commons-codec/commons-codec/1.15/commons-codec-1.15.jar
[ERROR] urls[6] = file:/home/piotr/projects/apache/repo/org/apache/maven/shared/maven-common-artifact-filters/3.2.0/maven-common-artifact-filters-3.2.0.jar
[ERROR] urls[7] = file:/home/piotr/projects/apache/repo/org/apache/maven/shared/maven-shared-utils/3.3.3/maven-shared-utils-3.3.3.jar
[ERROR] urls[8] = file:/home/piotr/projects/apache/repo/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[9] = file:/home/piotr/projects/apache/repo/com/google/guava/guava/10.0.1/guava-10.0.1.jar
[ERROR] urls[10] = file:/home/piotr/projects/apache/repo/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
[ERROR] urls[11] = file:/home/piotr/projects/apache/repo/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[12] = file:/home/piotr/projects/apache/repo/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[13] = file:/home/piotr/projects/apache/repo/org/eclipse/sisu/org.eclipse.sisu.inject/0.0.0.M5/org.eclipse.sisu.inject-0.0.0.M5.jar
[ERROR] urls[14] = file:/home/piotr/projects/apache/repo/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[15] = file:/home/piotr/projects/apache/repo/org/codehaus/plexus/plexus-interpolation/1.19/plexus-interpolation-1.19.jar
[ERROR] urls[16] = file:/home/piotr/projects/apache/repo/org/codehaus/plexus/plexus-component-annotations/2.0.0/plexus-component-annotations-2.0.0.jar
[ERROR] urls[17] = file:/home/piotr/projects/apache/repo/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[18] = file:/home/piotr/projects/apache/repo/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[19] = file:/home/piotr/projects/apache/repo/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.jar
[ERROR] urls[20] = file:/home/piotr/projects/apache/repo/org/apache/maven/enforcer/enforcer-api/3.0.0/enforcer-api-3.0.0.jar
[ERROR] urls[21] = file:/home/piotr/projects/apache/repo/org/apache/maven/enforcer/enforcer-rules/3.0.0/enforcer-rules-3.0.0.jar
[ERROR] urls[22] = file:/home/piotr/projects/apache/repo/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar
[ERROR] urls[23] = file:/home/piotr/projects/apache/repo/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar
[ERROR] urls[24] = file:/home/piotr/projects/apache/repo/org/apache-extras/beanshell/bsh/2.0b6/bsh-2.0b6.jar
[ERROR] urls[25] = file:/home/piotr/projects/apache/repo/org/apache/maven/resolver/maven-resolver-util/1.6.1/maven-resolver-util-1.6.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>pzlc:cade:1-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
ok, the problem is that extra-enforcer-rules
has as dependency to org.apache.maven.shared:maven-dependency-tree
in version 2.1
.. but maven-enforcer-plugin:3.0.0
has 3.1.0
we can try to add dependency to plugin execution with version 2.1
... as workaround
but finally maven-dependency-tree
must be upgraded
That's not going to work: there can only be one version of a groupId/artifactId. Best is to fix it or go for the short term shade it.
Adding an explicit additional dependency on maven-dependency-tree
in the plugin configuration works for me (not saying it shouldn't be upgraded tho). The following configuration seems to be ok for us:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>1.8</maxJdkVersion>
</enforceBytecodeVersion>
</rules>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
However this workaround may potentially fail with another set of rules - the enforcer itself may not like it either...
Adding an explicit additional dependency on
maven-dependency-tree
in the plugin configuration works for me (not saying it shouldn't be upgraded tho). (...)<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0</version> <!-- (...) --> <dependencies> <dependency> <groupId>org.codehaus.mojo</groupId> <artifactId>extra-enforcer-rules</artifactId> <version>1.3</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-dependency-tree</artifactId> <version>2.2</version> </dependency> </dependencies> </plugin>
However this workaround may potentially fail with another set of rules - the enforcer itself may not like it either...
For me this is not working. I am hoping for a real fix.
/me too on the error with maven-enforcer 3.0.0, and /me too on adding
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>2.2</version>
not providing a successful work-around; with this in place, the root cause changes to Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.dependency.graph.DependencyCollectorBuilderException
; playing with the version (ahem) does not really change this.
Sorry!
Same issue after upgrading to SpringBoot 2.5.3 https://github.com/spring-projects/spring-boot/issues/27682
@pzygielo could You retest with the latest master?
could You retest with the latest master?
I just did with master currently pointing to d380fe56. For me, using Enforcer + extra rules from AspectJ Maven Plugin, it fixes the problem. A new release would be most welcome. Thank you very much.
As Alexander - I confirm, d380fe5 works fine for me. Thank you.
Freshly released m-enforcer-p 3.0.0 makes EER unusable.
Observed on