gpt4 book ai didi

maven - 不使用 Spring Boot 作为父 pom 会有什么后果?

转载 作者:行者123 更新时间:2023-12-01 01:51:18 25 4
gpt4 key购买 nike

我有一个多模块 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 的功能。有人可以解释如果我这样做会失去什么(如果有的话)吗?谢谢!

最佳答案

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

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

关于maven - 不使用 Spring Boot 作为父 pom 会有什么后果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44336765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com