azure-devopsazure-artifactsmaven-deploy-plugin

Azure Artifacts - deploy status 409 conflict - upstream already contains jar (maven)


I am performing the following command: mvn deploy. Some packages already exist, but some failed to upload so I wish to deploy the missing ones.

However, I get the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project myproject: 

Failed to deploy artifacts: Could not transfer artifact my.artifact:pom:1.3.4 from/to azure-dev (url.pom).

transfer failed for url.pom:

status: 409 Conflict - The feed 'dev' already contains file 'my.artifacts-1.3.4.pom' in package ....

The error message is clear, but after thorough searching, I cannot for the life of me find a way to simply skip deploying the existing ones and just deploy the missing ones.

Is there any way of solving this?

I've read the Azure Artifacts documentation and found nothing. Aside from that, I've checked all the possible settings in the DevOps portal relevant to Artifacts and there's nothing that would help my case.


Solution

  • One of the Key Concepts in Azure Artifact Feeds is immutability of artifacts by identifier and version.

    Read: https://learn.microsoft.com/en-us/azure/devops/artifacts/artifacts-key-concepts?view=azure-devops

    Once you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package with the same version number.

    You either need to use SNAPSHOT versions, see What exactly is a Maven Snapshot and why do we need it? or you need to raise the version, or you need to avoid the "mvn deploy" in some way (e.g. using pipeline artifacts, see https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml).