Update maven properties after new version using version plugin

I have a problem with a multi-module project in maven / jenkins. For example, my structure looks like this:

---ProjectA ----pom.xml --------ModuleA ---------pom.xml --------ModuleB ---------pom.xml ---ProjectB -----pom.xml 

For example, ModuleA has a dependency for something in ProjectB that is defined in ModuleA pom, except for the version that is defined only as a property and inherited from the ProjectA properties section.

I want to automate the release process to get rid of all manual version updates in all poms. So, after I released ProjectB, I need all the links in ProjectA.

EDIT More precisely, I want to release ProjectB, which should include the release of ProjectA (due to dependencies), and in new ProjectA snapshots I want links to the latest ProjectB.

Versions of maven plugins do this pretty well if you specify the dependency and version number in the same pom. My problem, as you can see, is that (I reflect) when the version plugin tries to check the property field in ProjectA pom, the property cannot be related to the dependency. And I guess the version plugin is looking at efficient pom, because it MAY find that the dependency in ModuleA pom needs to be updated. He simply cannot update it due to the fact that he is not defined there.

I would really appreciate a solution that could save my properties in the parent room.

thanks

+4
source share
1 answer

Good. So I think I decided something, but I will post it here for others to see.

So, the problem is that autoLinkItem only looks for the current file for binding, and if you want the property to be associated with a dependency not specified in the same file, you can explicitly tell the plugin in this.

Like this:

 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>versions-maven-plugin</artifactId> <version>1.2</version> <configuration> <properties> <property> <name>basis.version</name> <dependencies> <dependency> <groupId>com.mycompany.app.basis</groupId> <artifactId>ModuleBasis</artifactId> </dependency> </dependencies> </property> </properties> <includeProperties>basis.version</includeProperties> <generateBackupPoms>false</generateBackupPoms> <allowSnapshots>true</allowSnapshots> </configuration> </plugin> 
+4
source

All Articles