【问题标题】:Unable to find artifact from artifactory无法从神器中找到神器
【发布时间】:2016-02-15 03:45:29
【问题描述】:

我正在使用 JFrog artifactory 3.2.1.1 和 Maven 3.2.1。

我上传了一个构建项目,该项目存在于存储库浏览器下的 libs-snapshot-local 中。如果我浏览到 com.foo.project,我将在工件浏览器中看到 project-1.0-20151113.133436-1.jar 文件以及 pom 和元数据。

即使访问http://example.com:8081/artifactory/webapp/browserepo.html?42&pathId=libs-snapshot-local:com/foo/project/1.0-SNAPSHOT/project-1.0-20151113.133436-1.jar 也会显示里面的 jar 文件。

我使用来自 artifactory 的 settings.xml 生成器来生成我在以下 pom.xml 中使用的<repository> 标记:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.foo.bar</groupId>
  <artifactId>exampleApp</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>exampleApp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots />
      <id>snapshots</id>
      <name>libs-snapshot</name>
      <url>http://example.foo:8081/artifactory/libs-snapshot</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.foo</groupId>
                  <artifactId>project</artifactId>
                  <version>1.0</version>
                  <type>jar</type>
                  <includes>myFolder</includes>
                  <outputDirectory>${project.build.directory}/newFolder/js/gmoketest</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

我刚刚得到:

未能执行目标 org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (解包) 在项目 exampleApp 上:无法找到工件。找不到 com.foo:project:jar:1.0 在 http://example.com:8081/artifactory/libs-snapshot 被缓存在 本地存储库,直到更新才会重新尝试解析 快照间隔已过或强制更新

如果我改变 http://example.foo:8081/artifactory/libs-snapshot

http://example.foo:8081/artifactory/libs-snapshot-local 然后我得到:

[ERROR] 未能执行目标 org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (解包) 在项目 exampleApp 上:无法解析工件。无法转移 来自/到快照的工件 com.foo:project:jar:1.0 (http://example.com:8081/artifactory/libs-snapshot-local): 失败 传输文件: http://example.com:8081/artifactory/libs-snapshot-local/com/foo/project/1.0/project-1.0.jar。 返回码为:409,ReasonPhrase:Conflict。

我会不时地将新快照部署到同一个 project-1.0 中,并希望这个 pom 文件在从工件构建时仅包含最新的 SNAPSHOT 构建。

【问题讨论】:

    标签: maven-3 pom.xml artifactory


    【解决方案1】:

    答案是,因为我很快发现需要将版本指定为:

    <version>1.0-SNAPSHOT</version>
    

    【讨论】:

    • 你能澄清一下你在哪里遗漏了版本条目吗?
    • 您在哪个文件以及文件的哪个位置添加了此版本属性?
    猜你喜欢
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 2018-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多