加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何配置settings.xml以从Artifactory私有虚拟存储库中提取?

发布时间:2020-12-16 23:18:50 所属栏目:百科 来源:网络整理
导读:我是Apache Archiva的资深人士,他最近转投Artifactory Pro.我一直试图在Artifactory中复制一个我在Archiva中实现虚拟私有存储库的设置.最终结果应该是不同的团队可以访问他们自己团队的工件,远程存储库,默认本地存储库和公司范围的存储库. 但是,每当我配置我
我是Apache Archiva的资深人士,他最近转投Artifactory Pro.我一直试图在Artifactory中复制一个我在Archiva中实现虚拟私有存储库的设置.最终结果应该是不同的团队可以访问他们自己团队的工件,远程存储库,默认本地存储库和公司范围的存储库.

但是,每当我配置我的Maven settings.xml以使用我的私有虚拟存储库时,我只能下载一些依赖项,这些依赖项可以从Maven Central获取和从中提取.如果我使用Artifactory的默认settings.xml(libs-release,libs-snapshot,plugins-release,plugins-snapshot和no virtual repository),那么我可以下载Maven Central上可用的所有依赖项以及我的项目所需的依赖项.

我在Windows服务器2012虚拟服务器上运行他们提供的Tomcat上的Artifactory v4.4.2.我没有在代理后面跑.我对Archiva没有这样的问题.

关于我的私有虚拟存储库设置,我有一个名为“test”的虚拟存储库,它是一个“通用”软件包类型.该存储库包含以下存储库:

> remote-repos
> libs-release
> libs-snapshot
>插件发布
>插件快照
> test-release-local
> test-snapshot-local
>公司发布 – 本地
> company-snapshot-local

列出的前5个repos是提供Artifactory的默认虚拟存储库repos.列出的最后4个回购是本地回购,它们是通用包类型.

我想我应该用镜子.

这是我正在使用的一个示例settings.xml(我的用户名和密码将填充在我保存到Maven conf文件夹的生成的settings.xml中):

<?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下载所有依赖项.这对我来说毫无意义.我的虚拟存储库配置为包含remote-repos虚拟存储库,因此应该能够从Maven Central中提取所有内容.

我究竟做错了什么?

解决方法

好吧,这里的实际情况似乎是 this is a bug与通用虚拟存储库的预定义 layout相关.
在修复此问题之前,建议的解决方法是基于简单默认布局创建新的存储库布局.
所以,而不是简单的默认布局:
[orgPath] / [模块] / [模块] – [baseRev]( – [fileItegRev]).[EXT]

应该创建一个新的布局,如下所示:
[orgPath] / [模块] / [模块] – [baseRev] [EXT]

创建此新存储库布局后,可以将存储库的已定义布局更改为新创建的存储库布局.

这将解决您提到的行为.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读