不使用Spring Boot作为父pom的后果是什么?

时间:2017-06-02 20:14:05

标签: maven spring-boot

我有一个多模块Maven项目,共享一个共同的父pom。其中一些模块将使用Spring Boot,但有些模块不会。我不想使用Spring Boot作为我的父pom的父亲,并且在不使用它们的模块中有不必要的依赖。

不使用Spring Boot父pom有什么后果?一切仍然适用于所有自动配置的优点吗?我正在考虑将以下解决方案放在我的父pom中作为替代

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

但我对所有这些Maven的东西和Spring Boot都很陌生,所以我不想要任何意想不到的后果或以任何方式声明Spring Boot的功能。如果我这样做,有人可以解释一下我会失去什么(如果有的话)?谢谢!

1 个答案:

答案 0 :(得分:3)

Reference Guide解释了如何在没有spring-boot-starter-parent的情况下使用Spring Boot以及将会发生什么。 This answer还解释了spring-boot-starter-parentspring-boot-dependencies之间的区别。

总结:通过这两种方式,您可以获得所有Spring Boot组件和第三方库的强大依赖关系管理。 spring-boot-starter-parent还配置了一些Maven插件,例如spring-boot-maven-plugin,用于运行mvn spring-boot:run

相关问题