【问题标题】:Artifacts are "missing" when using Artifactory使用 Artifactory 时“缺少”工件
【发布时间】:2020-02-13 14:44:42
【问题描述】:

我有一个 Eclipse 项目,我正在尝试使用 Maven 构建,其 JAR 文件位于我的私有 Artifactory 服务器上,并且 其他一些 Maven 存储库。

在我的 POM 文件中(在添加我的 Artifactory 存储库之前)我指定了存储库:

 <repositories>
 <repository>
    <id>third-party</id>
    <name>Atlassian 3rdParty</name>
    <url>https://repo.spring.io/plugins-release/</url>
 </repository>
 <repository>
    <id>ICM</id>
    <name>ICM Repository</name>
    <url>http://maven.icm.edu.pl/artifactory/repo/</url>
 </repository>
 </repositories>

这些存储库使我能够访问构建所需的多个库,包括(但不限于):

      ...
    <dependency>
       <groupId>xerces</groupId>
       <artifactId>xerces</artifactId>
       <version>2.4.0</version>
   </dependency>     
   <dependency>
     <groupId>com.oracle</groupId>
     <artifactId>ojdbc6</artifactId>
     <version>11.2.0.3</version>
   </dependency>
   <dependency>
     <groupId>com.sun.mail</groupId>
     <artifactId>javax.mail</artifactId>
   </dependency>
       ...

我有几个 JAR 文件想从我的 Artifactory 服务器访问。这些文件位于我创建的名为 Factor_Snapshot,有两个:factorbase-1.0.0.jar 和 lowerbase-1.0.0.jar。

为了通过 Artifactory 获取所有内容(正确使用它作为 remore 存储库的代理,我将这些存储库添加到 Artifactory。然后我使用“设置我”链接尝试为 POM 文件生成正确的条目.

我注意到的一件事是,我似乎无法让生成的条目包含 Factor_Snapshot 存储库。生成的条目似乎只包括之前存在的 libs-release 和 libs-snapshot 存储库。当我点击 Generate Maven Settings 并选择一个快照时,我只允许选择 libs-snapshot、gradle-dev、libs-release 等。我的快照存储库 Factor_Snapshot 无法选择。生成的设置如下所示:

<?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>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://192,168.1.230:8081/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192,168.1.230:8081/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://192,168.1.230:8081/artifactory/libs-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192,168.1.230:8081/artifactory/libs-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

当然,由于似乎没有用于在 Eclipse 中放入活动配置文件的 settings.xml 文件,我怀疑我是否可以使用该文件 反正。另外:目前还不清楚如何获取文件中引用的加密密码。

根据我在 Artifactory 服务器上的组织方式,我添加了以下依赖项:

      ...
   <dependency>
      <groupId>com.factor3</groupId>
      <artifactId>lowerbase</artifactId>
      <version>1.0.0</version>
    </dependency>
   <dependency>
      <groupId>com.factor3</groupId>
      <artifactId>factorbase</artifactId>
      <version>1.0.0</version>
   </dependency>
       ...

我相信我正确设置了它们。保存 POM 文件后,我确实收到了错误消息,说工件 lowerbase:jar 和 factorbase:jar 丢失。这是意料之中的,因为我还没有放入存储库声明。

我确实猜到了 repo 声明,所以我根据 Artifactory 文档和 repo 的设置方式在我的 POM 文件中创建了以下条目:

 <repositories>
    <repository>
      <id>snapshots</id>
      <name>soliandisk</name>
     <url>http://192,168.1.230:8081/artifactory/Factor_Snapshot</url>
 </repository>
 <repository>
    <id>third-party</id>
    <name>Atlassian 3rdParty</name>
    <url>https://repo.spring.io/plugins-release/</url>
 </repository>
 <repository>
    <id>ICM</id>
    <name>ICM Repository</name>
    <url>http://maven.icm.edu.pl/artifactory/repo/</url>
 </repository>
 </repositories>

但是当我添加 Factor_Snapshot 存储库时,现在我收到失败消息,说 所有 JAR 文件工件都丢失了——甚至是 factorbase 和 lowerbase 工件!

我知道我在配置中遗漏了一些东西,但我不知道是什么。

如何配置 Artifactory 和我的 POM 文件,以便获取所有必需的 JAR?

【问题讨论】:

    标签: eclipse maven-2 artifactory


    【解决方案1】:

    您的网址http://192,168.1.230:8081 包含逗号,,而不是句点.

    【讨论】:

      猜你喜欢
      • 2014-05-11
      • 1970-01-01
      • 2012-01-12
      • 2012-02-18
      • 2014-01-04
      • 2013-07-12
      • 1970-01-01
      • 1970-01-01
      • 2015-05-08
      相关资源
      最近更新 更多