views:

319

answers:

1

I have the need to create for a custom archetype. But just to expand and filter files as the archetype plugin supports is not enough, I need to do some more customization after the files got expanded. Now I've seen that the plugin supports a parameter called 'goals' and the docu says this about it: 'Additional goals that can be specified by the user during the creation of the archetype' (http://maven.apache.org/plugins/maven-archetype-plugin/generate-mojo.html#goals). But unfortunatly I can't find any documentation about how I can specify any goals while creating the archetype.

The following works:

$> mvn archetype:generate -DarchetypeCatalog=local  -Dgoals=antrun:run

But this has some major disadvantages: - The configuration of the goal has to be defined in the final POM of the new project - The user using the archetype has to know about the additional parameter

Has anyone an idea how the 'goals' parameter is realy meant to be used? Or has an idea how I can achieve my original target?

A: 

I have no idea of a valid use case for the -Dgoals parameter. The only "sample" I can find on the web is the following (and I don't find it meaningful):

mvn archetype:generate -DarchetypeCatalog=local -Dgoals=jetty:run

Actually, -Dgoals isn't even mentioned in the Chapter 18. Using Maven Archetypes of Maven: The Definitive Guide a.k.a. the bible so I really wonder what was the original reason to add this feature to the archetype:generate goal.

Having that said, in your case, the -Dgoals parameter might indeed help to do some extra stuff but, as you mentioned, this would require your users to be aware of it and this is far from ideal. So, for my understanding, what can't you achieve using velocity templates?

EDIT: using -Dgoals=eclipse:eclipse is for now the most meaningful use case I can think about.

Pascal Thivent
You'r right, did create the JIRA entry...What I'd like to do, is to do modifications in the workspace aswell. e.g. configure the webcontainer
domi
Wow, that looks ambitious. Don't you think this is a separated concern?
Pascal Thivent
Well, I kind a agree, but in our organization this is a pretty well defined task and it would really be a snap to do so. (e.g. create a datasource)
domi
I see. Actually, it seems then acceptable to use `-Dgoals` for an internal process as long as you document it.
Pascal Thivent
BTW, wouldn't http://cargo.codehaus.org/DataSource+and+Resource+Support help?
Pascal Thivent
that right cargo would help (if it would support WebSphere :)), but the question is more when and how to trigger it. But for WAS we have our own plugin, supporting neerly every possible config option in the server/cell.
domi
OMG, you're using WAS. My condolences to you and your family :)
Pascal Thivent