【发布时间】:2017-08-04 18:31:59
【问题描述】:
正如可以在this answer 中读取的那样,SBT (sbt-assembly) 允许在导入重命名库的项目中重命名包。例如:
我想在我的项目中使用包org.pfcoperez.algorithms,但我想“看到”它,即:能够以com.algorithms 的形式导入它。
我知道 Maven Shade 插件可以重定位依赖项,如 here 所述:
<relocations>
<relocation>
<pattern>org.codehaus.plexus.util</pattern>
<shadedPattern>org.shaded.plexus.util</shadedPattern>
<excludes>
<exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
<exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
</excludes>
</relocation>
</relocations>
我可以使用它来生成具有新包结构的中间 jar。但是,我想避免使用那个中间工件。
是否可以像在 SBT 中一样在 Maven 项目中执行此操作?如果答案是肯定的,那该怎么做呢?
【问题讨论】:
标签: maven sbt maven-shade-plugin