简体   繁体   中英

Can I easily replace spring-boot-starter by spring-boot to avoid use of spring-boot-starter-parent?

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM