繁体   English   中英

为什么 Spring Boot 项目中的某些依赖项不需要指定版本?

[英]Why you don't need to specify the version for some dependencies in Spring Boot project?

我正在学习 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 的版本来自哪里? 谢谢!

依赖版本在您在 pom 文件的 parent 部分中指定的 pom 文件中声明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM