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



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


      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.

      <?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">

      pom.xml contains:




              marc_swingler Marc Swingler (Inactive)
              4 Vote for this issue
              5 Start watching this issue