Martin Höller schrieb:
On Tuesday 13 October 2009 Werner Punz wrote:
Hello everyone I am new to the maven archetype programming but I ran
instantly into a problem.
I have a custom archetype which should generate some java code
the java file has something like public static String ${myvar}
and I try to generate the code from the artefact via mvn
archetype:create .... -Dmyvar=myValue
but maven then complains:
org.apache.velocity.ReferenceException ${myvar} is not a valid reference.
The funny thin is that the standard parameters are passed down correctly
such as artifactId or groupId
so something like public static String ${groupId}
is resolved correctly.
I'm a archetype newbie but I think you should define something like this in
archetype-metadata.xml:
<requiredProperties>
<requiredProperty key="myvar">
<defaultValue>some-default</defaultValue>
</requiredProperty>
</requiredProperties>
See also
http://maven.apache.org/plugins/maven-archetype-plugin/examples/create-with-property-file.html
Actually I did that but the templates still do not pick the value up
unfortuntately. Never mind I simply programmed my own tool which does
exactly what I need, since I have to trigger all this outside of maven
anyway it was not a big loss except for a few hours of programming time.
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]