I created an archetype where you can set the moduleName (or expect to) using a required property moduleName, here is the archetype metadata xml (reduced, which I also tried with similar results)
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="modules-archetype">
<requiredProperties>
<requiredProperty key="moduleName">
</requiredProperty>
</requiredProperties>
<modules>
<module id="modules-${moduleName}-api"
dir="modules-__moduleName__-api"
name="modules-${moduleName}-api">
<fileSets>
<fileSet encoding="UTF-8">
<directory>src/main/java</directory>
</fileSet>
</fileSets>
</module>
</modules>
</archetype-descriptor>
After installing and generating, the moduleName value is not used in the directory name or the artifactid, the resuting values are
For the directory: project/module-__moduleName__-api
For the pom/artifactId: module-${moduleName}-api
The value is replaced correctly on some other files of the project, so no spelling problems I guess.
I've seen a lot of similar things, but all of them using rootArtifactId, and in fact if I use rootArtifactId (as the starting part of the name) it works as expected.
Not able to find a similar problem around, any idea why is it not working, or how to make it work?
I found a reasonable work-around.
Seems the only place where you can only use the rootArtifactId is the
<module>
element in the archetype descriptor, but in every other
place you can use the moduleName property without any trouble.
What I did:
Use ${moduleName} in
(<module>module-${moduleName}</module>)
Use __moduleName__ in
In the artifact descriptor
Things to fix after the project is created
All of this in a ant script embedded in a postcreate-pom.xml to be run after project creation.
And it worked smoothly.
Hope its useful for someone.
thanks to everybody that just take the time to read my question, tonio.