I have a parent pom.xml file which has a build section like so:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<inherited>true</inherited>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
In the child pom, I want to effectively add an executions node to the plugin, but without having to respecify the version and dependencies nodes - is there a way to do this?
You can simply add in your child pom:
The difference is path where you define plugin
build/pluginManagement/plugins- you have only configurationbuild/plugins- you declare what you want to executeEven more you can also move
executionstopluginManagement, then in child you can have:The nodes for plugin configuration from
pluginManagementandpluginsand all child are merged to effectivepom.You can always check how your
effectivepom will look: