You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Olivier DAUMAS <kr...@gmail.com> on 2013/03/25 11:44:27 UTC

Maven Archetype Generate using my own property

Hi,

I am trying to generate artefact from maven archetype and I would like to
generate some basic java classes depending on parameters given in the
command line.
call mvn archetype:generate -B -X -DarchetypeGroupId=myarchetypegroupid
-DarchetypeArtifactId=myarchetype -DarchetypeVersion=1.0-SNAPSHOT
-DgroupId=mygroupid -DartifactId=myartefact -Dversion=myversion
-Dpackage=com.amadeus.jcp.ui.modules.%MODULE% --Dmodulename=%MODULE%
-DclassName=%CLASSNAME%

Typically I need to be able to pass extra parameter that velocity will used
to filter some of the file contained into the archetype and will lead to
final java object with specific names.
But only some of them like groupid and artefactid are available in velocity
filtering.

package com.amadeus.jcp.ui.modules.${modulename};
public class public class ${className}Handler{
private static final Logger s_logger = LoggerFactory
.getLogger(${className}Handler.class);

....

Do you have any idea how to manage passing my own variables ?

Olivier