Maven project depending on two versions of the same artifact

If you’re absolutely sure, what you’re doing, you can repackage one of the version using something like maven-shade-plugin. But please be absolutely sure, what you’re doing.

With maven-shade-plugin you could create a new Maven module, say jline:jline_2_10:jar:1.0 and use jline:jline:jar:2.10 as a dependency. The maven-shade-plugin would then package it in your jline_2_10-1.0.jar.

Since your new artifact has its own groupId:artifactId combination, there will be no conflicts with the other jline:jline:jar:0.9.94 artifact, so you’ll happily have both in the classpath.

Leave a Comment