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
hth
- martin
signature.asc
Description: This is a digitally signed message part.
