Maven project depending on two versions of the same artifact

前端 未结 2 1368
谎友^
谎友^ 2020-12-03 17:49

I have a project with two seperate modules that uses sqlline and another library(say OtherLib) that depends on jline. However on different versions.

External Librari

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 18:42

    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.

提交回复
热议问题