【发布时间】:2020-03-06 12:20:33
【问题描述】:
我正在学习Spring Boot,我看到您不需要为某些依赖项指定版本,但您需要为其他依赖项指定版本。这个依赖的版本来自哪里?
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.dgs</groupId>
<artifactId>n-tier-and-jackson</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>n-tier-and-jackson</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<paypal.rest.easy.version>2.3.3-RELEASE</paypal.rest.easy.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
<version>${paypal.rest.easy.version}</version>
</dependency>
...
例如在这段代码中你不需要为 spring-boot-starter-jersey 指定版本,但你需要为 resteasy-spring-boot-starter 指定版本。 spring-boot-starter-jersey 的版本来自哪里?谢谢!
【问题讨论】:
-
对于我们未提及版本的所有其他 spring starter depdencies,使用在文件的 pom.xml 顶部定义的父 spring starterdependecy 的版本来选择版本
-
我强烈建议使用最新版本的 Spring Boot,这意味着 2.2.1.RELEASE 并且不再使用 1.X,因为它的生命周期已经结束。
-
你了解父项目的工作原理吗?
标签: java maven spring-boot dependencies