Reputation: 11
I have a parent platform BOM like this:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>platform-bom</artifactId>
<version>7.0.LTS.9</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<!-- Third Party Dependencies Managed Via third-party BOM -->
<dependency>
<groupId>com.company</groupId>
<artifactId>third-party</artifactId>
<version>7.0.LTS.9</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.company</groupId>
<artifactId>api</artifactId>
<version>7.0.LTS.9</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
I am importing it like this in my project:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>platform-bom</artifactId>
<version>7.0.LTS.9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
When I am importing api dependency like below, it automatically pulls the version from the imported BOM.
<dependency>
<groupId>com.company</groupId>
<artifactId>api</artifactId>
</dependency>
However when I try to do the same for the third party bom, it is not able to pull the version from the imported BOM.
<dependency>
<groupId>com.company</groupId>
<artifactId>third-party</artifactId>
<type>pom</pom>
</dependency>
Error I get is: Unresolved dependency: 'com.company:third-party:pom:unknown'. Is there a way to pull the version from the BOM which is imported? If not, I think it defeats the purpose of having a BOM in the first place.
Upvotes: 1
Views: 97