使用maven程序集插件覆盖资源文件 [英] Overwrite resource file with maven assembly plugin
本文介绍了使用maven程序集插件覆盖资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用maven-assembly-plugin和jar-with-dependencies打包jar。有2个依赖项工件有log-back.xml。第二个工件取决于第一个工件。我希望在最终jar中有第二个工件的log-back.xml,但它总是包含第一个工件的log-back.xml。那么我该如何控制呢?
I use maven-assembly-plugin with "jar-with-dependencies" to package jar. There are 2 dependencies artifact having log-back.xml. The second artifact is depend on the first one. I want to have log-back.xml of the second artifact in final jar, but it always contain log-back.xml of the first one. So how can I control this?
谢谢
推荐答案
你可以使用 unpackOptions 来实现此目的。尝试以下内容:
You can use the unpackOptions to achieve this. Try something like the following:
<assembly>
...
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<include>${groupId}:${artifact.whose.logback.is.to.be.excluded} </include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>**/logback.xml</exclude>
</excludes>
</unpackOptions>
</dependencySet>
<dependencySet>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>${groupId}:${artifact.whose.logback.is.to.be.excluded}</exclude>
</excludes>
<unpack>true</unpack>
</dependencySet>
</dependencySets>
</assembly>
这篇关于使用maven程序集插件覆盖资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文