类似于:How to exclude library dependencies with explicit URL from generated pom?
我想从目标pom中删除项目依赖项,因为我使用fat jar将其合并。
我尝试projectDependencies in makePom := Nil
,但看起来任务makePom
从root/*:ivyModule
获取其依赖关系:
makePom -> ivyModule -> moduleSettings -> allDependencies -> projectDependencies
答案 0 :(得分:2)
您可以覆盖process
类上的MakePomConfiguration
字段,并提供一个功能,从生成的dependencies
中删除pom.xml
元素。
import xml.{NodeSeq, Node => XNode, Elem}
import xml.transform.{RuleTransformer, RewriteRule}
libraryDependencies += "org.apache.derby" % "derby" % "10.4.1.3"
def dependenciesFilter(n: XNode) = new RuleTransformer(new RewriteRule {
override def transform(n: XNode): NodeSeq = n match {
case e: Elem if e.label == "dependencies" => NodeSeq.Empty
case other => other
}
}).transform(n).head
makePomConfiguration := makePomConfiguration.value.copy(process = dependenciesFilter)