I require to generate some sources, so i attached a plugin goal to the generate-sources lifecycle phase.
When I run mvn package it works fine, but when I run mvn install I noticed that my source generation plugin executes twice.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources-id</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<property name="build.compiler" value="extJavac" />
<ant target="generate-sources-from-ant" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Any ideas to fix the problem ?
I had a similar issue that was caused because i used maven-source-plugin The solution was to change the goal to jar-no-fork
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>