I have the following plugin configuration in my project:
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<includes>
<include>AA</include>
</includes>
</configuration>
<executions>
<execution>
<id>the_same_id</id>
<phase>process-test-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
and the following plugin configuration in my parent pom:
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<lineEnding>LF</lineEnding>
<includes>
<include>A</include>
<include>B</include>
<include>C</include>
</includes>
</configuration>
<executions>
<execution>
<id>the_same_id</id>
<phase>process-sources</phase>
<goals>
<goal>sort</goal>
</goals>
</execution>
</executions>
</plugin>
When I run mvn help:effecive:pom this is the merged configuration of my plugin:
<plugins>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>the_same_id</id>
<phase>process-test-classes</phase>
<goals>
<goal>check</goal>
<goal>sort</goal>
</goals>
<configuration>
<includes>
<include>AA</include>
</includes>
<lineEnding>LF</lineEnding>
</configuration>
</execution>
</executions>
<configuration>
<includes>
<include>AA</include>
</includes>
<lineEnding>LF</lineEnding>
</configuration>
</plugin>
According to this the default merging behavior of the plugins configuration:
is to merge the content of the configuration element according to element name.
which is shown in the includes section as it only contains the ones from the project pom and not from the parent pom. However following that logic I don't understand why the effective-pom configuration contains two goals rather than only the one from the project configuration.
CodePudding user response:
EDIT: It is properly documented in POM reference, plugins section. Thanks Karl for pointing this out!
In the codebase responsible for merging it is slightly different for each of the properties.
If your goals are not excluded, then these will be merged together.
Also, your configuration may be merged differently, given the plugin's lifecycle configuration too.