• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven inheritance for plugin configurations

 
Prash Negu
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Just wanted to know how inheritance works in maven. Lets say i have pom project-a and project-b which inherits project-a. Below snippet shows maven-release plugin configuration.

project-a
..........
<plugin>
<artifactId>maven-release-plugin</artifactId>
<goals>deploy</goals>
<autoVersionSubmodules>true</autoVersionSubmodules>
<updateBranchVersions>true</updateBranchVersions>
<releaseProfiles>profile1</releaseProfiles>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
...............

project -b (extends prpject-a)
..........
<plugin>
<artifactId>maven-release-plugin</artifactId>
<goals>deploy</goals>
<autoVersionSubmodules>true</autoVersionSubmodules>
<updateBranchVersions>true</updateBranchVersions>
<releaseProfiles>profile2</releaseProfiles>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
...............

Now, another jar project-c extends project-b. If i release project-c using maven release plugin, will both profiles profile1 and profile2 will be executed or ONLY profile2 is executed?

Thanks,
Prashant
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that only profile2 is applied because the settings in project B override the settings in project A.
 
Prash Negu
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks. Could you please help me achieve below requirement?

As i mentioned in the example, project-c is extending project-b and when project-c is released profile1 and profile2 both should be applied. I have another project project-d that extends project-a and when it is released only profile1 should be applied.

Thanks,
Prashant
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The including the maven-release-plugin section in your pom.xml file project-c and use this:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic