【发布时间】:2015-02-09 13:05:53
【问题描述】:
我正在尝试配置父 POM 的 distributionManagement 部分,以允许将库和插件上传到不同的 Artifactory 存储库,但 maven 3 仅支持 distributionManagement 配置的一部分。
由于我使用不同的存储库来下载插件和库,并且无法为每种类型的工件创建一个父 POM,是否可以配置不同的存储库以让 Artifactory 或简单的 maven 识别工件的类型并部署到正确的存储库?
这是当前的 pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ornanization</groupId>
<artifactId>corporative-parent</artifactId>
<packaging>pom</packaging>
<distributionManagement>
<repository>
<id>artifactoryRelease</id>
<name>artifactory-libs-releases<name>
<url>${artifactory.url}/libs-release-local</url>
</repository>
<snapshotRepository>
<id>artifactorySnapshot</id>
<name>artifactory-libs-snapshots</name>
<url>${artifactory.url}/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
</project>
这是我要添加的条目:
<distributionManagement>
<repository>
<id>artifactoryRelease</id>
<name>artifactory-plugins-releases</name>
<url>${artifactory.url}/plugins-release-local</url>
</repository>
<snapshotRepository>
<id>artifactorySnapshot</id>
<name>artifactory-plugins-snapshots</name>
<url>${artifactory.url}/plugins-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
p.s.:正如 Artifactory 用户指南的this page 中所述,不能仅将构建工件“部署到远程或虚拟存储库”到本地存储库,因此无法让 Artifactory 的布局管理识别工件的类型。
【问题讨论】:
-
用于下载您的 settings.xml 是您定义下载工件的位置的正确位置,而 distributionManagement 用于上传工件。除此之外,插件和库之间的区别并没有真正意义......
-
实际上,由于我们在公司环境中,我们已经尝试让本地配置文件尽可能小,因此,尽管有最佳实践,我们仍需要将存储库配置保留在超级POM。但我同意存储库之间不必要的区别。我将尝试与负责 Artifactory 服务器的人员争论以更改此布局。
标签: java maven deployment artifactory