Skip to end of metadata
Go to start of metadata

Moving over from mailing list:

Related Jira:

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:

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:

would look like this:

        <goal>dependency:tree -Dverbose=true</goal>
        <module dir="biz.objects">
            <goal>some other goal to run on this module</goal>
        <module dir="ui">

important parts:

  • maybe have goals for whole thing, and also in individual modules?
  • must run in order listed in metadata file
  • must allow stuff that command line allows, like "-D" switches and fully-qualified/partially-qualified goal names
  • the repo containing the archetype/catalog should automatically be included when searching for the plugin

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

  • No labels