Search code examples
javamavenmaven-archetypearchetypes

How can change pom.xml property when creating new project from local archetype?


I am trying to create arhetype from my own maven project. I have some properties at pom.xml as;

<properties>
    <path.property>${path}</path.property>
</properties>

This property is used at my project from command line. I wanna create archetype and use this property at when generation of new project from this archetype. So new project's pom.xml property value of path.property will be variable which is entered.

For example when i entered -Dpath=/src/main/java while new project generation with my archetype, i want to have like this pom.xml ;

<properties>
    <path.property>${path}</path.property>
</properties>

Thanks for helping..


Solution

  • You need to define your custom property path in the archetype-metadata.xml. If you define the property as required, then the property will be prompted when you use the archetype from command line.

    http://maven.apache.org/archetype/archetype-common/archetype-descriptor.html