-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mvn versions:display-dependency-updates throws llegalArgumentException: Comparison method violates its general contract! #1147
Comments
Google took me to: and then to so finally starting as at least is a workaround. |
Can you provide a minimal project (pom.xml) to run the goal on in order to reproduce the problem? |
sorry, but i this happened only on one very big project with tons of dependencies. |
Does this happen with other Maven versions on this particular project? |
Looking at the stack trace, it seems that it's an error within Resolver (so, Maven) rather than in the plugin itself. Compare especially:
DefaultVersionRangeResolver::resolveVersionRange: List<Version> versions = new ArrayList<>();
...
Collections.sort( versions ); <-------- So, it looks like |
https://issues.apache.org/jira/browse/MRESOLVER-314 |
@RalfNaujokat please make sure that you're using Maven 3.9.1 or newer. Best if you could provide an (obfuscated, if necessary) output of |
Hi. Sorry that i left you alone with that, i wasn't available over weekend. I will try to reproduce the error and send you a mvn -X output, greetings |
The issue is coming from Maven itself (we use The -X (debug) output of Maven will help verifying that. In particular, it's very important to check if there are no "unorthodox" version numbers among your dependency as that's where the comparator is having a problem with. |
Using Maven 3.9.9 with different JDKs (Oracle Java 21, GraalVM 21/23) on Linux
StackTrace is:
`
== BEGIN ==
[ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.17.1:display-dependency-updates (default-cli) on project libraries: Unable to acquire metadata for dependencies java.util.stream.ReferencePipeline$2@629591d0: java.lang.IllegalArgumentException: Comparison method violates its general contract! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.17.1:display-dependency-updates (default-cli) on project libraries: Unable to acquire metadata for dependencies java.util.stream.ReferencePipeline$2@629591d0: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to acquire metadata for dependencies java.util.stream.ReferencePipeline$2@629591d0: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at org.codehaus.mojo.versions.DisplayDependencyUpdatesMojo.execute (DisplayDependencyUpdatesMojo.java:477)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: org.codehaus.mojo.versions.api.VersionRetrievalException: Unable to acquire metadata for dependencies java.util.stream.ReferencePipeline$2@629591d0: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupDependenciesUpdates (DefaultVersionsHelper.java:533)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupDependenciesUpdates (DefaultVersionsHelper.java:543)
at org.codehaus.mojo.versions.DisplayDependencyUpdatesMojo.execute (DisplayDependencyUpdatesMojo.java:412)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.concurrent.FutureTask.report (FutureTask.java:122)
at java.util.concurrent.FutureTask.get (FutureTask.java:191)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupDependenciesUpdates (DefaultVersionsHelper.java:526)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupDependenciesUpdates (DefaultVersionsHelper.java:543)
at org.codehaus.mojo.versions.DisplayDependencyUpdatesMojo.execute (DisplayDependencyUpdatesMojo.java:412)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.ComparableTimSort.mergeHi (ComparableTimSort.java:870)
at java.util.ComparableTimSort.mergeAt (ComparableTimSort.java:487)
at java.util.ComparableTimSort.mergeForceCollapse (ComparableTimSort.java:426)
at java.util.ComparableTimSort.sort (ComparableTimSort.java:222)
at java.util.Arrays.sort (Arrays.java:1108)
at java.util.Arrays.sort (Arrays.java:1302)
at java.util.ArrayList.sort (ArrayList.java:1804)
at java.util.Collections.sort (Collections.java:145)
at org.apache.maven.repository.internal.DefaultVersionRangeResolver.resolveVersionRange (DefaultVersionRangeResolver.java:160)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveVersionRange (DefaultRepositorySystem.java:260)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupArtifactVersions (DefaultVersionsHelper.java:282)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupDependencyUpdates (DefaultVersionsHelper.java:553)
at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lambda$lookupDependenciesUpdates$4 (DefaultVersionsHelper.java:522)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
== END ==
`
The text was updated successfully, but these errors were encountered: