Maven 插件在子pom中被不必要地继承
这位官员建议在Maven 插件在子pom中被不必要地继承,maven,inheritance,pom.xml,maven-plugin,Maven,Inheritance,Pom.xml,Maven Plugin,这位官员建议在pluginManagement部分中配置的插件在子POM中继承。但是它也应该出现在部分中,以便应用这些继承的配置 但我观察到插件继承有一种奇怪的行为 我有一个多模块maven项目,在父pom的部分,我配置了下面的maven replacer插件 <build> <plugins> <plugin> <groupId>com.google.code.maven-r
pluginManagement
部分中配置的插件在子POM中继承。但是它也应该出现在
部分中,以便应用这些继承的配置
但我观察到插件继承有一种奇怪的行为
我有一个多模块maven项目,在父pom的
部分,我配置了下面的maven replacer插件
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
...
</configuration>
</plugin>
</plugins>
</build>
com.google.code.maven-replacer-plugin
替代者
1.5.3
过程资源
代替
...
令我惊讶的是,即使我没有在子pom的
部分添加这个插件,插件也会在子项目中执行。有人能告诉我为什么会这样吗
我还尝试过为子项目生成有效的pom&这个插件在子pom中继承,并且在父pom中定义了所有精确的配置
我有什么遗漏吗?我不想在子pom中继承父pom的插件。这是正常行为。父母身上的大部分东西都传给了孩子。您要做的是将该插件及其默认配置放入父级的pluginManagement中。只有在实际使用它的模块中,才能将它添加到插件中(没有版本和配置,因为父插件管理中已经有了版本和配置)。DependencyManager和pluginManagement部分仅定义默认值,但尚未用于任何用途。它们允许省略添加依赖项或插件的大部分内容(在其中一个子项中)