anorakgirl
anorakgirl

Reputation: 788

Accessing parent properties when generating a module from a Maven archetype

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.

Upvotes: 3

Views: 6625

Answers (1)

Behe
Behe

Reputation: 7940

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

More information can be found in the Maven Properties Guide.

Upvotes: 7

Related Questions