Java 如何从子 pom 覆盖 Maven 3.0 父插件属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19608334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to override Maven 3.0 parent plugin properties from child pom
提问by Dineshkumar
I have maven-war-plugin in parent.pom in that I have set manifestFile property but for one of my war I need to exclude the manifest File under my META-INF.
我在 parent.pom 中有 maven-war-plugin,因为我已经设置了 manifestFile 属性,但是对于我的一场战争,我需要在我的 META-INF 下排除清单文件。
I added the property </manifestFile> configuration of my war plugin in the child pom but it does not work
我在子 pom 中添加了我的战争插件的属性 </manifestFile> 配置,但它不起作用
采纳答案by Ryan Stewart
Child plugin configurations override parent plugin configurations, but if the configuration is on a parent plugin execution and not on the plugin itself, you can only override it in a corresponding child execution. You do that by creating an execution on the child with the same id as in the parent. If that wasn't clear, try posting the relevant configuration, and we might be able to give a more complete explanation. My answer to a similar questionmight help you understand.
子插件配置覆盖父插件配置,但如果配置在父插件执行上而不是在插件本身上,则只能在相应的子执行中覆盖它。您可以通过在具有与父级相同 id 的子级上创建一个执行来做到这一点。如果不是很清楚,请尝试发布相关配置,我们可能会给出更完整的解释。我对类似问题的回答可能会帮助您理解。