Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven generate-source ALWAYS Successful

Tags:

maven

I am trying to run a ant task in maven generate-sources phase.

However, after many non productive "successes" i've realised, that the build always succeeds regardless of anything i enter.

Here is the plugin config for the pom.xml of my module.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <configuration>
                            <tasks>
                                <fail message="Something wrong here."/>
                            </tasks>
                        </configuration>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

It still succeeds. If i place a bad ant file. Still succeeds.

Does anyone know what i could be doing wrong here?

The Compile/Clean/Install/Deploy phases all work fine. Just "generate-source" doesnt work at all.

My settings.xml file only contains Repo information Thanks for any advice

Edit:

I've been able to narrow the error down a little.

<configuration>
<target>
<echo message="hello ant, from Maven!"/>
<echo>Maybe this will work?</echo>
</target>
</configuration>

If place that within the configuration of the plugin, Not in the nested configuration in the execution tag. and run "mvn antrun:run" I see the echos. However If i place it in the nested configuration in the execution element, it doesnt show... Is there some link missing between my mvn goal and the antrun instruction?

I don't get it. The same configuration runs outside of the executions/execution tags, but not within.

like image 365
user1217209 Avatar asked Apr 10 '26 03:04

user1217209


1 Answers

Solution *Solution* Solution AHHH I found it! In my pom.xml I had all my 'plugins''plugin' configured under the 'pluginManagement' .. This 'pluginManagement' configures the plugins not for this project, but for all children project. Effectively a parent default config file for all children implementing the plugin.. I simply removed the 'pluginManagement' tags and it works...

Thank heavens. I've been looking at this for a full day...

like image 116
user1217209 Avatar answered Apr 15 '26 17:04

user1217209