java - custom maven archetype: default value for version not used -
in maven archetype definition, set default version 0.0.1-snapshot when user doesnt enter anything. however, when create project based on archetype, prompted version , default 1.0-snapshot.
how do correctly?
i defined version property in archetype.properties file , when compile archetype, says correct version , when change value in archetype.properties, can see console output changes accordingly.
just on creating project based on archetype, prompted version again.
thanks , tips!
(i'll provide code if necessary)
you can define custom properties in archetype metadata. have @ archetype-metadata.xml in meta-inf/maven. example:
my-archetype | + src | + main | + resources | + meta-inf | + maven | + archetype-metadata.xml a custom property version this:
<requiredproperties> <requiredproperty key="version"> <defaultvalue>0.0.1-snapshot</defaultvalue> </requiredproperty> <requiredproperties> more details in the docs.
when run mvn archetype:generate command referencing archetype above configuration you'll see in console output:
[info] using property: version = 0.0.1-snapshot or, if run mvn archetype:generate command parameter -dversion=foo you'll see in console output:
[info] using property: version = foo note: version is, of course, separate archetypeversion defines version of archetype rather version of module produced archetype.
wiki
Comments
Post a Comment