Add the following fragment to your pom.xml
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.gravitee</groupId>
<artifactId>gravitee-bom</artifactId>
<version>7.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Make sure your project inherit from the gravitee-parent >= 22.0.0
<parent>
<groupId>io.gravitee</groupId>
<artifactId>gravitee-parent</artifactId>
<version>22.0.16</version>
</parent>
Starting from version 20.0, gravitee-parent
does no longer include development dependencies and will focus on configuring build and maven plugins only.
All common development dependencies are now managed using gravitee-bom
giving us more flexibility, and a complete independence regarding how we build Gravitee’s products (CI) and what dependencies we need to develop them.
Gravitee BOM includes latest versions of development dependencies. It means that previous version of Gravitee’s product may not be compatible.
The most significant dependencies are:
-
vertx 4.5.x
-
netty 4.1.x
-
spring 6.1.x
-
jackson 2.15.x
With gravitee-bom
, dependencies are no longer inherited but imported. It means that if you want to upgrade a dependency locally only for your project you should follow these steps:
-
Ask yourself if it could be better to upgrade
gravitee-bom
instead, it could benefit to all Gravitee’s projects. -
If not, ask someone else of your team, you could be surprised ;-)
-
Ok, you really need to override that dependency version, I understand. There are plenty of situations where it makes a lot of sense. Just read on and you’ll be good.
To override a dependency, you just have to redeclare it in the <dependencyManagement />
section of your project’s parent pom.
The following example shows you how you can easily reimport the spring-framework-bom
and specify your own version:
<properties>
<spring.version>5.2.4</spring.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Import bom to properly inherit all dependencies -->
<dependency>
<groupId>io.gravitee</groupId>
<artifactId>gravitee-bom</artifactId>
<version>7.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
For those who think Maven is magic, there is no black magic under the hood. Maven will just resolve the version of the dependency taking the one defined closest to your project. However, you may have noticed that bom is imported after the spring-framework dependency because the precedence is applied in the order of appearance.