I'm adding new maven module to project. It will use spring-boot. Old modules are not using it. So, my new module must be child of parent project but at the same time must be a child of spring-boot-starter-parent. How can I make my project child of 2 different parent?
My current parent
<parent>
<groupId>com.somegroup</groupId>
<artifactId>Parent</artifactId>
<version>1.0</version>
</parent>
Spring-boot parent
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
Since Maven project can have only one parent you can use a different approach. Instead of inheritance, you can import spring-boot-dependencies
in the dependency management section and keep the original parent.
<parent>
<groupId>com.somegroup</groupId>
<artifactId>Parent</artifactId>
<version>1.0</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
You can read about the constraints in the official documentation, which are basically about the way you change the version of dependencies provided by Spring Boot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With