I am using the pluginManagement element in the parent pom.xml to configure plugins for all its children. For example, I have the following configuration:
<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>
The official documentation states that the plugin configured in pluginManagement should still be added to the plugins element in children's pumps. Indeed, if I remove this from child pom:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin>
then maven-dependency-plugin stops firing on the install phase. However, this does not seem to affect some other plugins, namely the maven-resource-plugin . Even if I donβt have
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> </plugin>
in my child pom, its copy-resources target still fires at the install stage and does the work that it configured to execute.
Why is this behavior present? Is there a list of plugins that are always inherited, or maybe I missed something?
Vladimir Matveev
source share