Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven phase executing twice

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 ?

like image 660
Bob Beamon Avatar asked Nov 23 '10 07:11

Bob Beamon


1 Answers

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>
like image 109
Yuval Rimar Avatar answered Nov 07 '22 11:11

Yuval Rimar