Search code examples
mavenmaven-archetype

Creating Maven archetype using required properties



I have created my own archetype which defines in archetype-metadata.xml a required property:

<requiredProperty key="version.wildfly">
    <defaultValue>16.0.0.Final</defaultValue>
</requiredProperty>

This property needs to be used in src/main/resources/archetype-resources/pom.xml as a property:

<properties>
    <version.server.bom>${version.wildfly}</version.server.bom>
</properties>

Indeed, when I create a project using this archetype, I'm being asked to confirm the default value for the property:

version.wildfly: 16.0.0.Final
 Y: : Y  

However, in the generated project's pom.xml, it is not specified anywhere to use this property. The pom.xml merely contains:

<properties>
    <version.server.bom>${version.wildfly}</version.server.bom>
</properties>

And thus the build fails. Did I use any wrong pattern to inject the property in the pom.xml ? Thanks


Solution

  • Don't use dot, try version-wildfly.

    looks like archetype consider dot-split property as internal use. see Custom Properties