Is it possible for a child POM to inherit profiles defined in the parent POM? If so, how?
Maven supports project inheritance. You can create a parent project that contains properties child projects have in common, and child projects inherit those properties from the parent project.
All Maven POMs inherit values from a parent POM. If a POM does not specify a direct parent using the parent element, that POM will inherit values from the Super POM. Project Inheritance shows the parent element of project-a which inherits the POM defined by the a-parent project.
Profiles are specified in pom. xml file using its activeProfiles/profiles elements and are triggered in variety of ways.
What you should do is check the profile behavior by doing the following : set activeByDefault to true in the profile configuration, run mvn help:active-profiles (to make sure it is effectively activated even without -Pdev1 ), run mvn install .
Profiles defined in a parent POM are inherited in a child POM extending the parent, there is nothing to do. And just in case, the Maven Help Plugin has very useful goals allowing to deal with profiles:
help:active-profiles
: lists the profiles which are currently active for the build.help:all-profiles
: lists the available profiles under the current project.I don't think it is inherited. http://www.dashbay.com/2011/03/maven-profile-inheritance/ http://looking4q.blogspot.com/2011/01/maven-profiles-inheritance.html You may find the profiles available is very likely because they are activated by default
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With