Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find artifact from artifactory

I am using JFrog artifactory 3.2.1.1 with Maven 3.2.1.

I uploaded a built project that exists in libs-snapshot-local under the repository browser. If I browse to com.foo.project, I will see the project-1.0-20151113.133436-1.jar file and pom and metadata in the artifactory browser.

Even accessing 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 shows me the jar file inside.

I used the settings.xml generator from the artifactory to generate the <repository> tag that I use in the following 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>

I just get:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack) on project exampleApp: Unable to find artifact. Failure to find com.foo:project:jar:1.0 in http://example.com:8081/artifactory/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced

And if I change http://example.foo:8081/artifactory/libs-snapshot

to http://example.foo:8081/artifactory/libs-snapshot-local Then I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack) on project exampleApp: Unable to resolve artifact. Could not transfer artifact com.foo:project:jar:1.0 from/to snapshots (http://example.com:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://example.com:8081/artifactory/libs-snapshot-local/com/foo/project/1.0/project-1.0.jar. Return code is: 409 , ReasonPhrase:Conflict.

I will keep deploying new snapshots now and then to the same project-1.0 and would like this pom file to just include the latest SNAPSHOT build when building from the artifactory.

like image 241
Ludwig Van Beethoven Avatar asked Nov 13 '15 14:11

Ludwig Van Beethoven


1 Answers

The answer was, as I quickly figured out that the version needs to be specified as:

<version>1.0-SNAPSHOT</version>
like image 89
Ludwig Van Beethoven Avatar answered Sep 29 '22 18:09

Ludwig Van Beethoven