Wednesday, March 03, 2010

Multiple usage of the maven exec plugin

So I was trying to use the maven exec plugin in my alert-operations sender pom in RHQ to automatically run a java class and generate some documentation.

I've added the maven exec plugin to the pom like this:

<!-- Generate tokens.xml file -->

As soon as I added this and tried to build after a mvn clean, the build failed without an obvious message why. Commenting out this plugin made the build succeed. Digging around showed that we have an other call to this plugin in the root pom. So there was some clash - but which?

I thought "perhaps I need to include the execution from the root pom in mine as well (via copy&paste). I did that and got an error message, that it is not possible to have two executions without an <id> in a pom. So it turned out that both executions had the same implicit id - even while being in different poms, so one was overwriting the other.

Now I have

<!-- Generate tokens.xml file -->

and everything is fine again.