我想生成一个不包含依赖项的pom文件。我尝试使用下面的代码清除依赖关系,但是依赖关系仍列在生成的pom中。
install.doFirst {
repositories.mavenInstaller {
pom.dependencies.clear()
}
}
为什么我需要这样做:当我将其上传到“自制”服务时,我需要在jar中包含一个pom文件,但是当该服务读取“+”作为依赖项的版本时,该服务会崩溃(我是使用动态依赖项)。
最佳答案
uploadArchives {
repositories {
mavenDeployer {
// Do not write any dependencies into the POM
pom*.whenConfigured { pom -> pom.dependencies.clear() }
}
}
}
关于maven - Gradle-生成没有依赖项的pom,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17280127/