Description
Hi,
I want to create a Maven Archetype with 2 requiredProperty :
<requiredProperty key="apiName" />
<requiredProperty key="resourceName" />
apiName is used for the artifactId as follow:
<requiredProperty key="artifactId">
<defaultValue>${apiName}</defaultValue>
</requiredProperty>
I want also to define transitive properties from these 2 first properties:
<requiredProperty key="camelCaseAPIName">
<defaultValue>${artifactId.replaceAll("^a|-a", "A").replaceAll("^b|-b", "B").replaceAll("^c|-c", "C").replaceAll("^d|-d", "D").replaceAll("^e|-e", "E").replaceAll("^f|-f", "F").replaceAll("^g|-g", "G").replaceAll("^h|-h", "H").replaceAll("^i|-i", "I").replaceAll("^j|-j", "J").replaceAll("^k|-k", "K").replaceAll("^l|-l", "L").replaceAll("^m|-m", "M").replaceAll("^n|-n", "N").replaceAll("^o|-o", "O").replaceAll("^p|-p", "P").replaceAll("^q|-q", "Q").replaceAll("^r|-r", "R").replaceAll("^s|-s", "S").replaceAll("^t|-t", "T").replaceAll("^u|-u", "U").replaceAll("^v|-v", "V").replaceAll("^w|-w", "W").replaceAll("^x|-x", "X").replaceAll("^y|-y", "Y").replaceAll("^z|-z", "Z")}</defaultValue>
</requiredProperty>
<requiredProperty key="camelCaseResourceName">
<defaultValue>${resourceName.replaceAll("^a|-a", "A").replaceAll("^b|-b", "B").replaceAll("^c|-c", "C").replaceAll("^d|-d", "D").replaceAll("^e|-e", "E").replaceAll("^f|-f", "F").replaceAll("^g|-g", "G").replaceAll("^h|-h", "H").replaceAll("^i|-i", "I").replaceAll("^j|-j", "J").replaceAll("^k|-k", "K").replaceAll("^l|-l", "L").replaceAll("^m|-m", "M").replaceAll("^n|-n", "N").replaceAll("^o|-o", "O").replaceAll("^p|-p", "P").replaceAll("^q|-q", "Q").replaceAll("^r|-r", "R").replaceAll("^s|-s", "S").replaceAll("^t|-t", "T").replaceAll("^u|-u", "U").replaceAll("^v|-v", "V").replaceAll("^w|-w", "W").replaceAll("^x|-x", "X").replaceAll("^y|-y", "Y").replaceAll("^z|-z", "Z")}</defaultValue>
</requiredProperty>
to have a camel case version of the 2 first properties.
For camelCaseAPIName property, it works because it uses artifactId property which is same as apiName. But for camelCaseResourceName it doesn't works because resourceName property is not added in velocity context. Only requiredProperty with no value and default value are set in velocity context.
See org.apache.maven.archetype.ui.generation.DefaultArchetypeGenerationConfigurator.configureArchetype(ArchetypeGenerationRequest, Boolean, Properties) line 262.
Could we have velocity context extended to property with value and no default value?
Best Regards.