[英]How to override plugin defined in parent maven project
Here's my project structure 这是我的项目结构
- parent
- sub-parent
- sub-module-1
- sub-module-2
- module-1
- module-2
Now, in the pom file of parent, I defined maven plugin in pluginManagement that could be used by module-1 and module-2. 现在,在父级的pom文件中,我在pluginManagement中定义了可以由module-1和module-2使用的maven插件。 And in sub-parent, I also want to define this maven plugin in pluginManagement which is used by sub-module-1 and sub-module-2. 在子父级中,我还想在pluginManagement中定义此maven插件,该插件由sub-module-1和sub-module-2使用。 But from what I see is that the plugin in sub-parent can not override that of parent. 但是从我看来,子父级中的插件无法覆盖父级中的插件。 Could anyone help on how to override that ? 任何人都可以提供帮助以解决该问题吗? Thanks 谢谢
You can include both <pluginManagement>
and <plugins>
with the same configuration at the same time in your module-1 and module-2 in case you are willing to override specifically their plugin configuration. 如果您愿意专门覆盖其插件配置,则可以在模块1和模块2中同时包含具有相同配置的<pluginManagement>
和<plugins>
。
Or else the plugin configuration by default would be overriding the behavior from the topmost pom.xml
(bottom to top) where it finds the pluginManagement
specified. 否则默认情况下,插件配置将覆盖最顶层的pom.xml
(从下至上)的行为,在该行为中找到指定的pluginManagement
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.