2 years ago
#71658
Charles
Can a Maven BOM contain another Maven BOM?
Can a Maven BOM(BOM1) contain another BOM(BOM2) in its dependencyManagement? If yes, how could the usage of BOM1 through inclusion in a pom.xml can use the dependencies from BOM2 in a project? Thanks in advance! To better explain the situation, the below works when i include both of the in the pom.xml of the service:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>my.custom.bom</groupId>
<artifactId>my.custom.bom</artifactId>
<version>${my.custom.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Whereas the following does notwhen I include it in the pom.xml of the service:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>my.custom.bom</groupId>
<artifactId>my.custom.bom</artifactId>
<version>${my.custom.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
And the my.custom.bom in the second situation includes the spring-boot-dependencies like so:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
To summarize when pom.xml includes BOM1 and BOM2 works, but when pom.xml includes BOM1 and BOM1 includes BOM2 no longer works.
maven
maven-plugin
spring-boot-maven-plugin
0 Answers
Your Answer