【发布时间】:2016-02-10 21:39:45
【问题描述】:
我是一名 Apache Archiva 资深人士,最近改用 Artifactory Pro。我一直在尝试在 Artifactory 中复制我在 Archiva 中实现虚拟私有存储库的设置。最终结果应该是不同的团队可以访问他们自己团队的工件、远程存储库、默认本地存储库和公司范围的存储库。
但是,每当我将 Maven settings.xml 配置为使用我的私有虚拟存储库时,我都无法仅下载 一些 依赖项,这些依赖项可在 Maven Central 上使用并从中提取。如果我使用 Artifactory 的默认 settings.xml(libs-release、libs-snapshot、plugins-release、plugins-snapshot 和无虚拟存储库),那么我可以下载 Maven Central 上可用且我的项目需要的所有依赖项。
我在 Windows server 2012 虚拟服务器中的他们提供的 Tomcat 上运行 Artifactory v4.4.2。我没有在代理后面运行。我对 Archiva 没有这样的问题。
关于我的私有虚拟存储库设置,我有一个名为“test”的虚拟存储库,它是一种“通用”包类型。该存储库包括以下存储库:
- 远程仓库
- 库发布
- 库快照
- 插件发布
- 插件快照
- 本地测试发布
- 本地测试快照
- 公司发布本地
- 公司快照本地
列出的前 5 个存储库是 Artifactory 提供的默认虚拟存储库存储库。列出的最后 4 个存储库是本地存储库,它们属于通用包类型。
我想我应该用一面镜子。
这是我正在使用的示例 settings.xml(我的用户名和密码填充在生成的 settings.xml 中,我保存到我的 Maven conf 文件夹中):
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
<id>central</id>
</server>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
<id>snapshots</id>
</server>
</servers>
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>test</name>
<url>http://localhost:8082/artifactory/test</url>
<id>test</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://localhost:8082/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://localhost:8082/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://localhost:8082/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://localhost:8082/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
我无法通过我的虚拟存储库从 Maven Central 提取的工件示例是 poi-ooxml-schemas-3.10-FINAL.jar 或许多 Apache Maven 插件。删除镜像部分后,我可以从 Maven Central 下载所有依赖项。这对我来说毫无意义。我的虚拟存储库配置为包含远程存储库虚拟存储库,因此应该能够从 Maven Central 中提取所有内容。
我做错了什么?
【问题讨论】:
-
我应该提一下,我已经从 remote-repos 虚拟存储库中禁用并删除了 jcenter 本地存储库。我在下载 Maven Central 上存在的一些依赖项时遇到了问题。我将其替换为直接指向 Maven Central 的新本地存储库。
-
调试此类问题的最佳方法是发送跟踪请求。这将准确地向您展示 Artifactory 为解决依赖关系而在幕后所做的事情。例如localhost:8082/artifactory/test/org/apache/poi/…
标签: java maven maven-2 maven-3 artifactory