I'm a little puzzled by my Jenkins output.
Job on Jenkins: (shortened pom.xml at the bottom)
mvn deploy -Pprofile1
All my plugins will run 4 times:
- parent/pom.xml
- parent/module1/pom.xml
- parent/module2/pom.xml
- parent/module3/pom.xml
I need:
- first-maven-plugin: only run once in the parent pom.xml
- second-maven-plugin: run for every pom.xml
Why:
- first-maven-plugin: will run in phase:initialize --> rather long cleanup operation. Don't want this 4 times
- second-maven-plugin: will run in phase:package --> necesaary for all pom's.
Parent pom.xml
<project ...>
<groupId>com.test.parent</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>parent</name>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<profiles>
<profile>
<id>profile1</id>
<build>
<plugins>
<plugin>
<groupId>com.test.plugin</groupId>
<artifactId>first-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<execution>
<id>execution1</id>
<phase>initialize</phase>
<goals>
<goal>doit</goal>
</goals>
</execution>
</plugin>
<plugin>
<groupId>com.test.plugin2</groupId>
<artifactId>second-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<execution>
<id>another</id>
<phase>package</phase>
<goals>
<goal>goforit</goal>
</goals>
</execution>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>