Howto create dynamic named folders with Maven2 Archetype?
- by chrsk
Hey, i try to build a structure like this
+---src
+---main
+---webapp
+---WEB-INF
+---cfg
¦ +---log4j
¦ +---resources
¦ +---extensions
¦ +---${artifactIdKey}-business
¦ +---${artifactIdKey}-layout
+---lib
I added a required property to my archetype-metadata.xml to have an short-name for the project, which is used among other things for generating unique folders.
<requiredProperties>
<requiredProperty key="artifactIdKey" />
</requiredProperties>
The property artifactIdKey i use in a fileSet:
<fileSet>
<directory>[..]/resources/extensions/${artifactIdKey}-business</directory>
</fileSet>
<fileSet>
<directory>[..]/resources/extensions/${artifactIdKey}-layout</directory>
</fileSet>
The command to generate the archetype:
mvn archetype:generate -B \
-DgroupId=com.stackoverflow \
-DartifactId=stackoverflow-question -DarchetypeGroupId=com.stackoverflow \
-DarchetypeArtifactId=stackoverflow-archetype -DarchetypeVersion=1.0 \
-DartifactIdKey=soq
I assume to get the following folder structure, but i get the ${artifactIdKey} property as folder. Without beeing replaces.
..\
+---soq-business
+---soq-layout
..\
+---${artifactIdKey}-business
+---${artifactIdKey}-layout
How can i achieve this? And how can i place files below soq-business? Without knowing the folder name at this time?