简体   繁体   English

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

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

I'm learning about Spring Boot and I see that you don't need to specify the version for some dependencies, but you need to specify the version for other dependencies.我正在学习 Spring Boot ,我看到您不需要为某些依赖项指定版本,但您需要为其他依赖项指定版本。 Where does the version of this dependencies comes from?这个依赖的版本来自哪里?

    <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>

...

For example in this code you don't need to specify the version for spring-boot-starter-jersey, but you need to specify the version for resteasy-spring-boot-starter.例如,在此代码中,您无需为 spring-boot-starter-jersey 指定版本,但您需要为 resteasy-spring-boot-starter 指定版本。 Where does the version for spring-boot-starter-jersey comes from? spring-boot-starter-jersey 的版本来自哪里? Thank you!谢谢!

Dependencies versions are declared in the pom file that you have specified in the parent section of your pom file依赖版本在您在 pom 文件的 parent 部分中指定的 pom 文件中声明

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

相关问题 Spring Boot Project无法运行,为什么? - Spring Boot Project don't run why? 为什么要在Spring Boot中使用@PropertySource时需要指定@Configuration? - Why do you need to specify @Configuration when you want to use @PropertySource in Spring Boot? 为什么我的 Spring Boot starter 没有将其依赖项带到项目中? - Why doesn't my Spring Boot starter bring its dependencies to the project? Spring maven 中的某些依赖项的启动依赖项错误 - Spring boot dependency error for some of the dependencies in maven Spring 引导项目的 JUnit 和 Mockito 依赖项 - JUnit and Mockito Dependencies for Spring Boot Project 将 Spring 引导项目导出为具有依赖项的 JAR - Exporting a Spring Boot Project as a JAR with dependencies 单元测试时,在不需要时模拟测试 object 的依赖关系是否是一种好习惯? - When unit testing, is it good practice to mock the dependencies of the test object when you don't need to? 有些类需要初始化,有些则不需要 - Some classes need initialization and some don't 如何在 Spring/Spring Boot pom.xml 中指定 Java 版本? - How to specify Java version in Spring/Spring Boot pom.xml? java8 stream toArray 问题 - 为什么我不需要在这里为 int[][]::new 指定数组大小? - java8 stream toArray question - Why i don't need specify array size here for int[][]::new?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM