Re: Maven archtypes and custom parameters

2009-10-15 Thread Werner Punz

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:


  

  some-default

  

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: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Maven archtypes and custom parameters

2009-10-14 Thread Martin Höller
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:

  

  some-default

  

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.


Maven archtypes and custom parameters

2009-10-13 Thread Werner Punz
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.

Does anyone know how to resolve this how to pass down custom parameters
which then later are picked up internally by veclocity?


Werner


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org