You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Xenofon Papadopoulos <xp...@gmail.com> on 2009/08/06 08:36:34 UTC
Referencing properties in archetype-metadata.xml
Hello, I'm using trying to create an archetype, and I want to use some
properties. However <defaultValue> doesn't reference the included property
if it's already define, as I thought would be the norm. Here's an example:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="basic">
<fileSets>
[...]
</fileSets>
<requiredProperties>
<requiredProperty key="earname"/>
<requiredProperty key="context-root">
<defaultValue>${earname}</defaultValue>
</requiredProperty>
</requiredProperties>
</archetype-descriptor>
When I generate this project, I am asked for earname, but never for
context-root, and inside my project files ${context-root} will explode to
the ${earname} literal.
Any ideas?
Re: Referencing properties in archetype-metadata.xml
Posted by Saritha SV <sa...@gmail.com>.
The variable properties are considered invalid reference in
archetype-metadata.xml ..
so one way is to include <requiredProperty key="earname"/> in
archetype-metadata.xml ..
and the ${earname} can be referenced in properties file (usually under
src/main/resources) in the project ..
http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files
has some egs for including reference in properties file .
Thanks
Saritha SV
On Thu, Aug 6, 2009 at 3:56 PM, Xenofon Papadopoulos <xp...@gmail.com>wrote:
> I have already seen the file. However I understood "enable not to ask" as
> an
> option, whose behavior would be something like:
>
> Define value for context-root [default-value]:
>
> I guess 'enable not to ask' means 'enforce not to ask' :)
>
> Also what about the substitution? Is it impossible to have access to the
> default properties (${artifactId} etc) or previous defined properties in
> subsequent <defaultValue> ?
>
>
> On Thu, Aug 6, 2009 at 12:04 PM, Saritha SV <sa...@gmail.com>
> wrote:
>
> > Please see configurations used in archetype-metadata.xml in :
> >
> >
> http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-metadata.html
> >
> > When additional properties are defined that must be valued before the
> file
> > generation. The additional properties can be provided with default
> values,
> > which enable not to ask the user for there values.
> >
> > So here the value for context-root will not be asked since a default
> value
> > is provided ..
> >
> > Thanks
> > Saritha SV
> >
> >
> >
> > On Thu, Aug 6, 2009 at 12:06 PM, Xenofon Papadopoulos <xpapad@gmail.com
> > >wrote:
> >
> > > Hello, I'm using trying to create an archetype, and I want to use some
> > > properties. However <defaultValue> doesn't reference the included
> > property
> > > if it's already define, as I thought would be the norm. Here's an
> > example:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <archetype-descriptor name="basic">
> > > <fileSets>
> > > [...]
> > > </fileSets>
> > >
> > > <requiredProperties>
> > > <requiredProperty key="earname"/>
> > > <requiredProperty key="context-root">
> > > <defaultValue>${earname}</defaultValue>
> > > </requiredProperty>
> > > </requiredProperties>
> > > </archetype-descriptor>
> > >
> > > When I generate this project, I am asked for earname, but never for
> > > context-root, and inside my project files ${context-root} will explode
> to
> > > the ${earname} literal.
> > > Any ideas?
> > >
> >
>
Re: Referencing properties in archetype-metadata.xml
Posted by Xenofon Papadopoulos <xp...@gmail.com>.
I have already seen the file. However I understood "enable not to ask" as an
option, whose behavior would be something like:
Define value for context-root [default-value]:
I guess 'enable not to ask' means 'enforce not to ask' :)
Also what about the substitution? Is it impossible to have access to the
default properties (${artifactId} etc) or previous defined properties in
subsequent <defaultValue> ?
On Thu, Aug 6, 2009 at 12:04 PM, Saritha SV <sa...@gmail.com> wrote:
> Please see configurations used in archetype-metadata.xml in :
>
> http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-metadata.html
>
> When additional properties are defined that must be valued before the file
> generation. The additional properties can be provided with default values,
> which enable not to ask the user for there values.
>
> So here the value for context-root will not be asked since a default value
> is provided ..
>
> Thanks
> Saritha SV
>
>
>
> On Thu, Aug 6, 2009 at 12:06 PM, Xenofon Papadopoulos <xpapad@gmail.com
> >wrote:
>
> > Hello, I'm using trying to create an archetype, and I want to use some
> > properties. However <defaultValue> doesn't reference the included
> property
> > if it's already define, as I thought would be the norm. Here's an
> example:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <archetype-descriptor name="basic">
> > <fileSets>
> > [...]
> > </fileSets>
> >
> > <requiredProperties>
> > <requiredProperty key="earname"/>
> > <requiredProperty key="context-root">
> > <defaultValue>${earname}</defaultValue>
> > </requiredProperty>
> > </requiredProperties>
> > </archetype-descriptor>
> >
> > When I generate this project, I am asked for earname, but never for
> > context-root, and inside my project files ${context-root} will explode to
> > the ${earname} literal.
> > Any ideas?
> >
>
Re: Referencing properties in archetype-metadata.xml
Posted by Saritha SV <sa...@gmail.com>.
Please see configurations used in archetype-metadata.xml in :
http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-metadata.html
When additional properties are defined that must be valued before the file
generation. The additional properties can be provided with default values,
which enable not to ask the user for there values.
So here the value for context-root will not be asked since a default value
is provided ..
Thanks
Saritha SV
On Thu, Aug 6, 2009 at 12:06 PM, Xenofon Papadopoulos <xp...@gmail.com>wrote:
> Hello, I'm using trying to create an archetype, and I want to use some
> properties. However <defaultValue> doesn't reference the included property
> if it's already define, as I thought would be the norm. Here's an example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <archetype-descriptor name="basic">
> <fileSets>
> [...]
> </fileSets>
>
> <requiredProperties>
> <requiredProperty key="earname"/>
> <requiredProperty key="context-root">
> <defaultValue>${earname}</defaultValue>
> </requiredProperty>
> </requiredProperties>
> </archetype-descriptor>
>
> When I generate this project, I am asked for earname, but never for
> context-root, and inside my project files ${context-root} will explode to
> the ${earname} literal.
> Any ideas?
>