![](/img/trans.png)
[英]How can I test my Spring-Boot application without inheriting 'spring-boot-starter-parent' module?
[英]Can I easily replace spring-boot-starter by spring-boot to avoid use of spring-boot-starter-parent?
我想使用spring-boot-starter,但這意味着我必須使用“ spring-boot-starter-parent” pom,而不能使用公司廣泛使用的root pom。
當管理依賴項和插件一起使用時,Spring-boot-starter是一個巨大的優勢。 但這與我們公司廣泛使用的根pom的優勢相矛盾。
使用spring-boot-starter還有其他優點嗎? 是否有一種簡單的方法僅使用spring-boot而沒有spring-boot-starter?
如果您不想使用spring-boot-starter-parent
,仍然可以通過使用scope=import
依賴項來保留依賴項管理(而不是插件管理)的好處,如下所示:
<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>
在這里,您可以在Spring文檔中找到適當的部分,以了解更多詳細信息。
將所需版本的spring-boot-starter-parent
作為父級添加到公司的根pom.xml文件中。
通過這種方式, spring-boot
可以管理所有項目的所有依賴項。
您公司的父pom可以具有自己的<dependencyManagement>
以覆蓋和管理任何內部或第三方依賴項。
plugin management
更干凈。 您可以在項目和父級上定義自己的階段。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.