我使用sbt-assembly重新打包某些依赖项,因此,commons-logging.jar
完成后,此依赖项(例如sbt publishLocal
)已经打包到我的jar中,而本地路径中的ivy.xml
(~/.ivy/local/myorg.mygroup/demo_2.12/1.0.0-SNAPSHOT/ivys/ivy.xml
),仍然有依赖项,如何排除它们?
pomPostProcess
选项仅可用于pom.xml
,不适用于ivy.xml
,有些选项类似于makeIvyXml
,但我不知道如何配置sbt
的办公室站点上似乎没有文件。
//sbt version is 1.2.1
//project/plugins.sbt: addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
val root = (project in file(".")).settings(
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.apache.commons.**" -> "demo.$internal$.@1").inAll
),
libraryDependencies += "commons-logging" % "commons-logging" % "1.2"
)
实际:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<!-- ... ... -->
<dependencies>
<!-- Some dependencies here ... -->
<dependency org="commongs-logging" name="commongs-logging" rev="1.2" conf="compile->default(compile)"/>
<!-- Some other dependencies here ... -->
</dependencies>
</ivy-module>
预期:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<!-- ... ... -->
<dependencies>
<!-- Some dependencies here ... -->
<!-- I WANT THE FOLLOWING LINE TO BE OMMITED
<dependency org="commongs-logging" name="commongs-logging" rev="1.2" conf="compile->default(compile)"/>
-->
<!-- Some other dependencies here ... -->
</dependencies>
</ivy-module>