Skip to content
Latchkey

Nexus "400 Repository does not allow updating assets" in CI

A hosted release repository in Nexus has its deployment policy set to disable redeploy. Pushing a version that already exists returns 400 with "Repository does not allow updating assets". The version must be new, or the target must be a snapshot repo.

What this error means

mvn deploy of an already-published release version fails with "status code: 400 ... Repository does not allow updating assets" while the first publish of that version succeeded.

Nexus
[ERROR] Failed to deploy artifacts: Could not transfer artifact
com.example:app:jar:1.2.0 from/to nexus
(https://nexus.example.com/repository/maven-releases/): status code: 400,
reason phrase: Repository does not allow updating assets: maven-releases (400)

Common causes

Redeploying an existing release version

Release repos default to Deployment policy "Disable redeploy". Re-running a build that publishes the same non-SNAPSHOT version hits the immutability guard and returns 400.

A SNAPSHOT build pointed at the release repo

Sending -SNAPSHOT artifacts, or repeat builds of the same version, to maven-releases instead of maven-snapshots triggers the update block.

How to fix it

Bump the version instead of redeploying

  1. Treat published release versions as immutable; never redeploy them.
  2. Increment the version (or use a CI-generated build number) for a new artifact.
  3. Re-run the deploy with the new version.
Terminal
mvn -B versions:set -DnewVersion=1.2.1
mvn -B deploy -s settings.xml

Route snapshots to the snapshot repo

Point SNAPSHOT builds at maven-snapshots (which allows redeploy) and releases at maven-releases.

pom.xml
<distributionManagement>
  <repository>
    <id>nexus</id>
    <url>https://nexus.example.com/repository/maven-releases/</url>
  </repository>
  <snapshotRepository>
    <id>nexus</id>
    <url>https://nexus.example.com/repository/maven-snapshots/</url>
  </snapshotRepository>
</distributionManagement>

How to prevent it

  • Keep release versions immutable; bump for every publish.
  • Send SNAPSHOT builds to a snapshot repo that allows redeploy.
  • Do not enable "Allow redeploy" on release repos to hide a versioning bug.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →