Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven archetype filename pattern with underscore

I'm creating a Maven archetype. I want to generate files like project_todo_messages.properties with todo replaced by a filtered property.

I created a file project___todo___messages.properties and a filtered property todo in archetype-metadata.xml and archetype.properties. Files without underscore are renamed, but files with underscore around the filtered property are not. Any ideas?

I use maven-archetype-plugin 2.3 and org.apache.maven.archetype:archetype-packaging 2.3.

Other question : is it possible to lowercase a filtered value in a filename like it is possible in a file content with ${todo.toLowerCase()}?

like image 733
Johann Goulley Avatar asked Mar 16 '23 10:03

Johann Goulley


1 Answers

You can accomplish both by adding required properties with default values set to the filter you want.

For the first case:

<requiredProperty key="messagePropertiesFileName">
    <defaultValue>project_${todo}_messages</defaultValue>
</requiredProperty>

Name the file __messagePropertiesFileName__.properties.

For the second case, add yet another property:

<requiredProperty key="todoLowerCase">
    <defaultValue>${todo.toLowerCase()}</defaultValue>
</requiredProperty>

Use __todoLowerCase__ in folder/file names.

like image 164
Matt Eckert Avatar answered Mar 18 '23 23:03

Matt Eckert