我在我的父母pom.xml
中使用pluginManagement
元素爲其所有子項配置插件。例如,我有以下配置:Maven插件管理配置繼承奇怪行爲
<pluginManagement>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-artifacts</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>some/where/else</outputDirectory>
<resources>
<resource>
<directory>some/another/resource</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>deps/dir</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</pluginManagement>
的官方文件指出,在pluginManagement
配置插件仍然有被添加到plugins
元素孩子勁歌。事實上,如果我從孩子POM刪除此:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
然後maven-dependency-plugin
停在install
階段開火。但是,它似乎並不影響其他一些插件,即maven-resource-plugin
。即使我沒有
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
在我的孩子聚甲醛做的,它的目標copy-resources
火災仍然在install
階段,並執行它配置做的工作。
爲什麼會出現此行爲?有沒有一個永遠繼承的插件列表,或者我錯過了一些東西?
看看有效的POM來分析你的問題(通過mvn help:effective-pom)。 – khmarbaise
謝謝,完全忘了它。會看看。 –