Reputation: 20581
I have 2 profiles in my parent pom.xml
(for production and for development). So I want to inherit this profiles in my child modules... How I can achieve this? How I can inherit parent's profile? Or I need to specify profile with same ID in child module and all be ok?
Upvotes: 0
Views: 3599
Reputation: 97389
You need to give the following into your child pom.xml file to inherit from your parent which implies to inherit all profiles you have defined in your parent:
<project ..>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>TheGroupIdYourParentHas</groupId>
<artifactId>TheArtifactIdYourParentHas</artifactId>
<version>1.0.0</version>
</parent>
...
</project>
BTW. You should think about using profiles for distinguishing between production and development. Usually you should simply call
mvn package
to produce the right package which is for production without using of any profile. I wrote an blog article to handle such things in a better way.
Upvotes: 4