distributionManagement 与存储库下的存储库标签? [英] repository tag under distributionManagement vs repositories?

查看:79
本文介绍了distributionManagement 与存储库下的存储库标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在父元素下看到 repository 标签,即 distributionManagementrepositories.有什么区别?

I see repository tag under parent element i.e distributionManagement and repositories. What's the difference ?

<distributionManagement>
    <repository>
        <id>...</id>
        <name>...</name>
        <url>...</url>
    </repository>
</distributionManagement> 

<repositories>
    <repository>
        <id>...</id>
        <name>...</name>
        <layout>default</layout>
        <url>...</url>
    </repository>
</repositories>

我的理解 distributionManagement 元素下的 repository 元素指定了在部署时将在何处部署工件.它只会在 mvn deploy 即部署时间出现,而不是在 mvn install 即构建时间.对吗?

My understanding repository element under distributionManagement element specifies where it will deploy the artifacts at the time of deployment. It will come into picture only while mvn deploy i.e deployment time not during mvn install i.e build time. Right?

repository 元素指定需要从何处获取依赖项.它只会在 mvn install 时出现,不会在 mvn deploy 期间出现.对吗?

repository element under repositories element specifies from where dependencies needs to be picked up. It will come into picture only while mvn install not during mvn deploy. Right?

推荐答案

你说得对!

来自 POM 参考:

repositories 元素在 POM 中指定了 Maven 可以下载远程工件以供当前项目使用的位置和方式,distributionManagement 指定在哪里(以及如何) 该项目在部署后将进入远程存储库.如果未定义 snapshotRepository,则存储库元素将用于快照分发.

Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed. The repository elements will be used for snapshot distribution if the snapshotRepository is not defined.

  • distributionManagement 元素下声明的存储库将用于部署,即在运行 mvn deploy 时.
  • repositories 元素将用于下载项目的依赖项.该命令不一定是 mvn install,而是任何需要 Maven 从存储库中获取工件的命令.
    • Repositories declared under the distributionManagement element will be used for deployment, i.e. when running mvn deploy.
    • The repositories element will be used for downloading dependencies of the project. The command is not necessarily mvn install but any command that requires Maven to fetch artifacts from a repository.
    • 这篇关于distributionManagement 与存储库下的存储库标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆