2
votes

I want to use spring-boot-starter, but that means I have to use the "spring-boot-starter-parent" pom and cannot use the company wide used root pom.

Spring-boot-starter is a huge advantage when it comes to manage dependecy and plugin that go together. But that contradict the advantage of our company wide used root pom.

Are there further advantages of using spring-boot-starter? Is there an easy way to only use spring-boot without spring-boot-starter?

2

2 Answers

4
votes

If you do not want to use the spring-boot-starter-parent, you can still keep the benefit of the dependency management (but not the plugin management) by using a scope=import dependency, as follows:

<dependencyManagement>
        <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.0.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

And here you can find an appropriate section in Spring Documentation with more details.

2
votes

Add needed version of spring-boot-starter-parent as the parent to your company's root pom.xml file.

  • This way it is spring-boot that manages all the dependencies for all of your projects.

  • Your Company's parent-pom can have its own <dependencyManagement> to override and manage any internal or third-party dependencies.

  • The plugin management is cleaner this way. You can define your own stages on project and parent level.