3 回答

TA貢獻1859條經驗 獲得超6個贊
您可以像使用“ bom”一樣使用spring-boot-starter-parent(請參閱Spring和Jersey現在支持該功能的其他項目),并將其僅包含在scope = import的依賴項管理部分中。這樣您將獲得很多收益使用它的好處(即依賴項管理),而無需替換實際父項中的設置。
它做的其他2件事是
定義屬性負載以快速設置要覆蓋的依賴項版本
使用默認配置(主要是Spring Boot maven插件)配置一些插件。因此,如果您使用自己的父母,那么您將必須手動執行這些操作。
Spring Boot文檔中提供的示例:
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

TA貢獻1898條經驗 獲得超8個贊
根據Surasin Tancharoen的回答,您可能還需要定義maven surefire插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
并可能包括故障快速插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
分享編輯
- 3 回答
- 0 關注
- 781 瀏覽
添加回答
舉報