Reputation: 8624
The Maven project I'm working on inherits from a parent POM where some project-wide variables are calculated by executing the gmaven-plugin during the validate phase:
Parent POM:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>execute</goal></goals>
<configuration>
<providerSelection>2.0</providerSelection>
<source>
project.properties.put("test.property1", "123");
</source>
</configuration>
</execution>
</executions>
</plugin>
Now I wanted to use the gmaven-plugin also in a child POM to calculate and set some additional parameters:
Child POM:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>execute</goal></goals>
<configuration>
<providerSelection>2.0</providerSelection>
<source>
project.properties.put("test.property2", "abc");
</source>
</configuration>
</execution>
</executions>
</plugin>
However, this causes the plugin defined in the parent to disappear / to be overwritten. The effective POM contains only the plugin defined in the child and the test.property1
ends up as null
.
How can I execute a Maven plugin in the parent and another in the child without that they interfere with each other?
Upvotes: 1
Views: 863
Reputation: 2475
add :
<inherited>true</inherited>
like :
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5-jenkins-1</version>
<inherited>true</inherited>
Upvotes: 2
Reputation: 351
As far as I remember you could just configure another Executions section in child's pom and all references to parent's plugin would disappear.
Upvotes: 0