无法从神器中找到神器

Lud*_*ven 8 artifactory pom.xml maven-3

我在 Maven 3.2.1 中使用 JFrog artifactory 3.2.1.1。

我上传了一个已构建的项目,该项目存在于存储库浏览器下的 libs-snapshot-local 中。如果我浏览到 com.foo.project,我将在 artifactory 浏览器中看到 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 生成器来生成<repository>我在以下 pom.xml 中使用的标签:

<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>
Run Code Online (Sandbox Code Playgroud)

我只是得到:

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

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

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

[错误] 无法在项目 exampleApp 上执行目标 org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack): Unable to resolve artifact。无法从/向快照传输工件 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 构建。

Lud*_*ven 2

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

<version>1.0-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)

  • 您能澄清一下您到底在哪里缺少版本条目吗? (10认同)