Maven – Accessing parent properties when generating a module from a Maven archetype

maven

I have a number of maven archetypes which I am using to generate a multi-module maven project.

I have a required property on the archetype I use to generate the parent project. This gets added as a property in the pom.xml for the project.

I then generate a module within the project, using a different archetype. I would like the same value to be substituted within some of the resources in that module.

It seems wrong to supply it as a property again when calling the second archetype.

Is it possible to reference parent project properties during the archetype generation process for the module? I want the value to be substituted into files in the src tree of the module, not use a place holder so that it is substituted in the target folder.

Thanks for any help.

Best Solution

In Maven 3, you can access parent properties by ${project.parent.x}.

More information can be found in the Maven Properties Guide.

Related Question