Using a spring-bom project in a project which is not a child of the bom project

19 Views Asked by At

I am having a project structure like below.

platform-core

  • pom.xml

platform-bom (child-module of platform-core)

  • pom.xml (packaging type pom, Dependencies defined in )

We have all the common dependencies defined in the bom project.

I have multiple projects where we want to use the bom project for managing dependencies.

The issue comes here.

I have tried adding the bom project as a parent of the third project.

<parent>
        <groupId>com.test</groupId>
        <artifactId>platform-bom</artifactId>
        <version>0.0.1</version>
</parent>

And also as a dependency

<dependency>
            <groupId>com.test</groupId>
            <artifactId>platform-bom</artifactId>
            <version>0.0.1</version>
            <type>pom</type>
            <scope>import</scope>
</dependency>

In both the cases the dependencies defined in the bom project are not getting imported/added to the third project.

However if I change the scope to compile then the dependencies get's added successfully.

Can you please let me know the below.

  1. Is there anything that is wrong with the above config because of which the dependencies are not getting added?
  2. Is it fine to use the compile for a bom project in a child project?

NOTE When using the compile I have to redefine all the dependencies with scope of test and runtime again in the third project.

0

There are 0 best solutions below