无法从神器

时间:2015-11-13 14:18:18

标签: maven-3 pom.xml artifactory

我正在使用JFrog神器3.2.1.1和Maven 3.2.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生成器来生成我在以下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(unpack)   在项目exampleApp:无法找到工件。找不到   com.foo:project:jar:1.0 in   http://example.com:8081/artifactory/libs-snapshot被缓存在   本地存储库,在更新之前不会重新尝试解析   已经过快照间隔或强制更新

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

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

  

[错误]无法执行目标   org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack(unpack)   on project exampleApp:无法解析工件。无法转移   artifact com.foo:project:jar:1.0 from / to snapshots   (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。

我将继续部署新的快照,然后继续部署到同一个项目-1.0,并希望这个pom文件在构建神器时只包含最新的SNAPSHOT构建。

1 个答案:

答案 0 :(得分:1)

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

<version>1.0-SNAPSHOT</version>