For a Maven archetype, how to camel case a generated file name using ${artifactId}
in archetype-metadata.xml
? For example, sample-my
should give SampleMy.java
.
I supposed this is needed to be a velocity template but this require a macro to be specified in archetype-metadata.xml
. The macro could be created in pluginApp.java as shown at:
https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/archetype-resources/src/main/java/pluginApp.java#L4-L7
How can it be done archetype-metadata.xml
?
Exact fragment in question is at:
https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/META-INF/maven/archetype-metadata.xml#L14
I fixed it as follows:
<requiredProperty key="classPrefix" >
<defaultValue>
${package.getClass().forName("org.apache.velocity.util.StringUtils").removeAndHump("$artifactId", "-")}
</defaultValue>
</requiredProperty>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With