如何从maven程序集插件中排除依赖项:jar-with-dependencies?
Maven的程序集插件可以创建一个大jar,包括所有依赖于descriptorRef jar-with-dependencies
。
如何排除其中一些依赖? 好像它没有这样的配置? 还有其他解决方案吗?
此示例表明了一种方法:
.... commons-lang:commons-lang log4j:log4j ....
基本上我们将使用dependencySet
可用的excludes
选项。
另见: https : //maven.apache.org/plugins/maven-assembly-plugin/assembly-component.html
将
到您不希望包含在jar-with-dependencies中的依赖项,例如
storm storm 0.6.1-SNAPSHOT provided
您应该使用dependencySet
提供的excludes
选项。
遵循以下:
pom.xml中的示例:
... maven-assembly-plugin 2.3 ../final/${project.artifactId} false com.entrerprise.App src/main/resources/jar-with-deps-with-exclude.xml false make-assembly package single ...
现在在你的新文件jar-with-deps-with-exclude.xml (其中dependencySet live):
jar-with-dependencies-and-exclude-classes jar false / false true runtime junit:junit commons-cli:commons-cli org.apache.maven.wagon:wagon-ssh / ${project.build.outputDirectory}
就这样。