tags:

views:

174

answers:

1

I have a POM for my ejb project. In it I have added a maven-antrun-plugin execution step to build websphere ejb stubs during the verify phase. This works but is quite verbose, and as I need to add similiar steps to a number of other ejb projects I want to move the common section to a parent POM for all our ejbs.

My first try was to just move the entire build tag to the parent POM but this failed during install/deploy of the parent as the verify step was executed for the parent POM instead of just for the child POM.

My second try involved specifying ejb:verify for the phase. This partially succeeded in that the parent POM was deployable. However the verify step was not executed for the child POM.

I have tried several other variations including specifying a phase of ejb, ejb:ejb and specifying true in the plugin definition.

What is the correct way to do this?

A: 

If you put the configuration inside a pluginManagement section of your parent, then it won't run there. Then in the children you just need to bind the antrun plugin and it will inherit the execution config and run. This is nice because you can then control which of the children inherit the values.

You can see examples in the chapter I wrote here: http://www.sonatype.com/book/reference/optimizing.html#d0e8621

Brian Fox