I'm creating a maven archetype and in the projects generated a want a class that is named after the artifact id of the generated project.
The artifact id will be formatted like: the-project-name
and the class should be named TheProjectNameMain
.
I've tried to do this in my archetype-metadata.xml
but I can't get it right.
<archetype-descriptor>
<requiredProperties>
<requiredProperty key="classNamePrefix">
<defaultValue>${WordUtils.capitalize(artifactId.replaceAll("-", " ")).replaceAll(" ", "")}</defaultValue>
</requiredProperty>
</requiredProperties>
</archetype-descriptor>
As you can see i tried to use WordUtils (from apache-commons) but i'm guessing this is not available because i'm getting an error. Error merging velocity templates:....
. I also tried different combinations of .replaceAll
but i couldn't get the right format.
Does anyone know of a way to go from a-hypenated-string to a CamelCaseClassName in this case?