I'm building an archetype for generating Maven projects for our custom 
application framework. Everything is working but the generated project always 
has the same class names and annotations. I would like to be able to 
dynamically specify those names/annotations.

For example, I can specify my Java file 
(src/main/resources/archetype-resources/src/main/java/ClientApp.java) like this:

package ${packageName};

// imports go here...

@OurAnnotation(client="Client", application="ClientApp", 
version="1.0.0-SNAPSHOT")
public class ClientApp extends OurBaseClass {
...
}

but what I'd like to do is something like this:

package ${packageName};

// imports go here...

@OurAnnotation(client="${client}", application="${clientApp}", 
version="${clientAppVersion}")
public class ${clientApp} extends OurBaseClass {
...
}

I tried the above and using:

mvn archetype:generate -DarchetypeGroupId=... -DarchetypeArtifactId=... 
-DarchetypeVersion=... -Dclient=Acme -DclientApp=HelloWorld6 
-DclientAppVersion=1.0.0-SNAPSHOT -DgroupId=net.interactions.example 
-Dversion=0.0.1-SNAPSHOT -DartifactId=hello-world-6

my generated ClientApp.java file had the correct package name 
(net.interactions.example), but none of the other substitutions were performed. 
Also, I'd need the generated file itself to have the correct name 
(${clientApp}.java). I'd have preferred that the generated file be named 
"HelloWorld6.java" and have the content:

package net.interactions.example;

// imports go here...

@OurAnnotation(client="Acme", application="HelloWorld6", 
version="0.0.1-SNAPSHOT")
public class HelloWorld6 extends OurBaseClass {
...
}


Is what I want to do possible?
--
Rick Genter
[email protected]



*******************************************************************************
This e-mail and any of its attachments may contain Interactions Corporation
proprietary information, which is privileged, confidential, or subject to
copyright belonging to the Interactions Corporation. This e-mail is intended
solely for the use of the individual or entity to which it is addressed. If you
are not the intended recipient of this e-mail, you are hereby notified that any
dissemination, distribution, copying, or action taken in relation to the
contents of and attachments to this e-mail is strictly prohibited and may be
unlawful. If you have received this e-mail in error, please notify the sender
immediately and permanently delete the original and any copy of this e-mail and
any printout. Thank You. 
*******************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to