【问题标题】:What is the purpose of dependency management tag in pom.xml?pom.xml中依赖管理标签的作用是什么?
【发布时间】:2020-04-02 14:57:59
【问题描述】:

谁能解释一下这个依赖在依赖管理下的作用以及添加它之后为什么我们不需要提及依赖的版本?

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
    </dependencies>

【问题讨论】:

标签: spring-boot maven dependencies pom.xml dependency-management


【解决方案1】:
  • dependencyManagement 使它们可用,但您需要将它们导入您希望它们加载到的每个子模块中。用作版本控制,并避免在每个模块或子项目中加载所有依赖项的臃肿项目。

  • dependencies为每个继承它们的模块或子级加载它们。

【讨论】:

    猜你喜欢
    • 2015-07-26
    • 1970-01-01
    • 2017-03-19
    • 2012-05-18
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    • 2011-08-10
    • 1970-01-01
    相关资源
    最近更新 更多