Maven Versioning Plugin

I am looking for an opportunity to manage versions of a maven project.

I have some maven modules in my maven project, and some of these modules depend on other of these modules.

I want to define a version for working globally for each module or dependency.

How is this possible?

Sort of

globalVersion=2.0 <groupId>test</groupId> <artifactId>test</artifactId> <version>${globalVersion}</version> 

But, as I said, not in every single pump. I mean globally for all my pops in my maven modules.

+4
source share
1 answer

(I assume you have a parent pom common to all of your modules.)

define a property in the parent pom:

 <properties> <globaleVersion>1.0.0</globalVersion> </properties> 

And define the <dependencyManagement> section in the parent pump:

 <dependencyManagement> <dependencies> <dependency> <groupId>test</groupId> <artifactId>test</artifactId> <version>${globalVersion}</version> </dependency> <dependency> <groupId>A</groupId> <artifactId>A</artifactId> <version>${globalVersion}</version> </dependency> </dependencies> </dependencyManagement> 

And your modules define dependencies without specifying the version (maven will find it from the parent's dependencyManagement section)

  <dependencies> <dependency> <groupId>test</groupId> <artifactId>test</artifactId> </dependency> <dependency> <groupId>A</groupId> <artifactId>A</artifactId> </dependency> </dependencies> 
+5
source

Source: https://habr.com/ru/post/1469503/


All Articles