In the provided Maven POM snippet, the question arises on why the maven-dependency-plugin ceases to function when enclosed within the pluginManagement tag.
The pluginManagement element in Maven is used to manage plugin configuration that can be inherited by child modules. It does not override plugins already defined in the project's
In this case, the
Therefore, to retain plugin functionality, the maven-dependency-plugin must also be explicitly declared within the
<project> ... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> </plugins> ... <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> ... </plugin> </plugins> </pluginManagement> ... </project>
By following this practice, you can share plugin configurations across modules while still maintaining individual plugin execution within each module.
The above is the detailed content of Why Doesn't Maven Execute Plugins Defined Only in `pluginManagement`?. For more information, please follow other related articles on the PHP Chinese website!