Search code examples
javamavenmaven-archetype

Creating Maven ArcheType . Setting file name


I want to create an Archetype in which the user can provide artifactId. Then I want to take this artifactId and create two files.

Here is an example.

artifactId= box

FILE 1: copy-box.txt
FILE 2 : Box.java

Creating copy-box.txt is quite easy. But how to create Box.java with B capital?


Solution

  • I looked through the code that creates the replacement in the filenames of the archetype resources (which can be found here). It seems that the values of the arguments are taken from the context, which means that they are not evaluated. In my opinion, for the moment it is not possible (sad, but true) to use the evaluation mechanism directly in the file names.

    However, by simply implementing the FilesetArchetypeGenerator interface, a good contribution can be made to the archetypes generation.