Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-5404

Artifactory Does Not Return Latest Snapshot When The 'libs-snapshot-local' Repo Has "Maven Snapshot Version Behavior" set to "Nonunique" despite -U and updatePolicy=always

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Deferred
    • Affects Version/s: 2.6.5, 2.6.6
    • Fix Version/s: None
    • Component/s: Artifact Storage
    • Environment:
    • Severity:
      Critical

      Description

      I have a pom only project which uses the 'Copy' goal of the 'Maven Dependency Plugin' to specify non-transitive dependencies. Some artifactItems point to SNAPSHOTs stored in 'libs-snapshot-local.' The 'libs-snapshot-local' repo has it's "Maven Snapshot Version Behavior" set to "Nonunique." I run:

      mvn -Dmaven.repo.local=.m2 -f pom.xml -U -B clean process-sources --settings settings.xml

      The first time the command is run maven hits my Artifactory server and successfully retrieves SNAPSHOTS and released artifacts as expected. This includes version '0.1.13-SNAPSHOT' of 'artifact1'. The artifact 'artifact1' is a tar.gz containing a file named version.properties. This file contains information like, GroupID, ArtifactID, Version, Type, Classifier, HG Rev, Jenkins URL, Jenkins Job Name, and Jenkins Build#. I verify the info in version.properties corresponds to the latest SNAPSHOT build. (i.e.: we're at build X, HG rev Y, Version Z...)

      Next, I build/deploy another SNAPSHOT of 'artifact1' still at version '0.1.13-SNAPSHOT'. Then I run maven again:

      mvn -Dmaven.repo.local=.m2 -f pom.xml -U -B clean process-sources --settings settings.xml

      As expected the process-sources goal attempts to re-download all snapshots from artifactory. But it only brings down the maven-metadata.xml. The version.properties file should be at build X+1. But it's not, it's still at X. I double check Artifactory and manually download the SNAPSHOT. It says X+1.

      I suspect Artifactory is reporting incorrect maven-metadata.

      Additionally, if I change the "Maven Snapshot Version Behavior" to "Unique" and "Max Unique Snapshots" to "1", wipe out both my local .m2, and any old snapshots under the 'artifact1' and retry the steps above, the problem goes away. Cleaning up and switching back to "Nonunique" brings the problem back again.

      I'd go for the work around of changing my repo permanently to "Unique/1" but that causes other issues. Specifically, old snapshots are still left sitting around with -SNAPSHOT and the name of the downloaded file changes from -SNAPSHOT to contain the unique timestamp. Since I have hundreds of projects and ~30000 builds stored in Artifactory, I can't do that.

      settings.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <servers>
      <server>
      <id>remote-repos</id>
      <username>jenkins</username>
      <password>my_encrptyed_pw</password>
      </server>
      </servers>
      <interactiveMode>false</interactiveMode>
      <mirrors>
      <mirror>
      <id>remote-repos</id>
      <mirrorOf>!libs-release-local,!libs-snapshot-local,*</mirrorOf>
      <url>http://myserver.mydomain.com:8080/artifactory/remote-repos</url>
      </mirror>
      </mirrors>
      <profiles>
      <profile>
      <repositories>
      <repository>
      <id>libs-release-local</id>
      <releases>
      <updatePolicy>never</updatePolicy>
      <checksumPolicy>fail</checksumPolicy>
      </releases>
      <snapshots>
      <enabled>false</enabled>
      </snapshots>
      <url>http://myserver.mydomain.com:8080/artifactory/libs-release-local</url>
      </repository>
      <repository>
      <id>libs-snapshot-local</id>
      <releases>
      <enabled>false</enabled>
      </releases>
      <snapshots>
      <updatePolicy>always</updatePolicy>
      <checksumPolicy>fail</checksumPolicy>
      </snapshots>
      <url>http://myserver.mydomain.com:8080/artifactory/libs-snapshot-local</url>
      </repository>
      </repositories>
      <id>artifactory</id>
      </profile>
      </profiles>
      <activeProfiles>
      <activeProfile>artifactory</activeProfile>
      </activeProfiles>
      </settings>

      pom.xml contains:
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>2.6</version>
      <executions>
      <execution>
      <phase>process-sources</phase>
      <goals><goal>copy</goal></goals>
      <configuration>
      <outputDirectory>.</outputDirectory>
      <artifactItems>
      <artifactItem>
      <groupId>com.mydomain.myproject</groupId>
      <artifactId>artifact1</artifactId>
      <version>0.1.13-SNAPSHOT</version>
      <type>tar.gz</type>
      </artifactItem>
      <artifactItem>
      <groupId>com.mydomain.myproject</groupId>
      <artifactId>artifact2</artifactId>
      <version>1.2.5</version>
      <type>tar.gz</type>
      </artifactItem>
      <artifactItem>
      <groupId>com.mydomain.myproject</groupId>
      <artifactId>artifact3</artifactId>
      <version>3.4.1-SNAPSHOT</version>
      <type>tar.gz</type>
      </artifactItem>
      </artifactItems>
      </configuration>
      </execution>
      </executions>
      </plugin>

        Attachments

          Activity

              People

              Assignee:
              Unassigned
              Reporter:
              marc_swingler Marc Swingler (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Sync Status

                  Connection: RTFACT Sync
                  RTMID-5404 -
                  SYNCHRONIZED
                  • Last Sync Date: