Moving over from mailing list: http://maven.40175.n5.nabble.com/Fwd-archetype-catalog-xml-and-its-properties-and-goals-elements-what-populates-them-tp2843289p2844753.html

Related Jira: http://jira.codehaus.org/browse/ARCHETYPE-328

Allow goals to be attached to pre/post Velocity template processing in archetype generation process

I want logic to run after (and maybe before as well?) the current archetype Velocity template generation process.

Some useful functionality simply can't be offered with Velocity templates alone.  What's needed is some "extra spice" in the form of <goals> which can be configured in the archetype metadata file.

I'll just go over my current use and you can extract the generalized feature:

My team creates project pairs (biz-objects and UI-layer) which are plugins to a larger system.  Whenever a new project pair is needed, there is a specific template layout the projects should adhere to, and the SVN check-in paths should be consistent with the other projects.  SVN-ignores must be set up.  Also, a maintenance folder containing SVN-externals pointing to portions of the projects pairs must be updated.  There's a huge team wiki page listing all the steps needed to create a new project pair.

So I've been able to remove most of the manual work by creating a multimodule project containing a custom plugin and the multimodule (for the project pair) archetype.  The archetype and custom plugin are really inseparable.  They don't make sense without each other.  Also, no one will ever just run the archetype without also running the custom goals afterwards, and vice versa.

sidenote: for me, a nifty tool for these these one-off plugins is to write the mojos in Groovy, and utilize Ant.  example that doesn't even use half the power it could: http://pastebin.com/MT4Hkj7i

There's all sorts of other possibilities of attaching goals to archetype generation.  If you can think of some, please comment.  For example, if I could figure it out I would have the custom plugin create the corresponding Hudson projects.

The proposal is to add <goals> to the archetype descriptor: http://maven.apache.org/archetype/archetype-common/archetype-descriptor.html

would look like this:

<archetype-descriptor>
    <goals>
        <goal>org.codehaus.mojo:versions-maven-plugin:1.2:use-releases</goal>
        <goal>dependency:tree -Dverbose=true</goal>
    </goals>
    <modules>
        <module dir="biz.objects">
          <goals>
            <goal>some other goal to run on this module</goal>
          </goals>
        </module>
        <module dir="ui">
        </module>
    </modules>
</archetype-descriptor>

important parts:

other sidenote:

ARCHETYPE-276 doesn't get enough love.  "Allow archetypes to declare minimum version of maven-archetype-plugin they need."  Users need some indication when the archetype plugin they are using isn't new enough to support the archetype's ambitions.

another thing that's criminal:

the fact that this wiki system (Confluence?) doesn't retain your post if forget to type in the captcha, I had to type this whole thing over again because I didn't see those mangled words