Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: Import pom properties from different pom

I would like to import properties from a project X pom file into my project Y pom such as library versions. I do not want to make the project X my project's parent.

I have tried to include project Xs pom in the dependency management section as an import.

<dependency>
                <groupId>abc</groupId>
                <artifactId>def</artifactId>
                <version>1.1</version>
                <type>pom</type>
                <scope>import</scope>
</dependency>

Please advise. Thanks.

like image 649
user518066 Avatar asked Jul 10 '15 13:07

user518066


1 Answers

The usual approach to share dependency versions without using parent POMs are BOMs.

These are separate projects that only contain a pom.xml which consists of <dependencyManagement>. This can then be imported in several other projects with <scope>import</scope>.

These other projects then import the dependencyManagement inside the BOM.

like image 131
J Fabian Meier Avatar answered Sep 20 '22 16:09

J Fabian Meier