maven - distributionManagement 与存储库下的存储库标签?

标签 maven

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

<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 元素指定在部署时将 Artifact 部署到的位置。它只会在 mvn deploy 时出现,即部署时间,而不是在 mvn install (即构建时间)期间出现。对吗?

repositories 元素下的

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

最佳答案

你说得完全正确!

来自POM reference :

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 从存储库获取 Artifact 的命令。

关于maven - distributionManagement 与存储库下的存储库标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35317118/

相关文章:

java - 如何使生成的构建 war 包含基于 Git 提交 ID 的构建号?

java - XText 项目的 Maven 依赖关系

java - 使用 pom 构建时应用程序上下文文件发生更改

java - 使用 maven-bundle-plugin 包含来自 Spring XML 的依赖项

java - HTTP Status 404 – 在 Eclipse 中安装 maven 后未找到

maven - 使 Storm JAR 仅在 Gradle 项目中编译

JavaFX : Need help understanding project hierarchy issues

java - 使用 maven,如何将 war 配置到 ear 文件中

java - Hudson 不使用 Maven 生成的类路径?

eclipse - 在 Eclipse 中使用 Maven 生成的源