403 Forbidden or does not allow updating artifact error Publishing an artifact⚓︎
Question⚓︎
You are receiving one of the following errors trying to publish an artifact to Central Repository:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy)
on project my-project: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy failed:
403 - Forbidden -> [Help 1]
[ERROR] Nexus Staging Rules Failure Report
[ERROR] ==================================
[ERROR]
[ERROR] Repository "comibeetl-1683" failures
[ERROR] Rule "RepositoryWritePolicy" failures
[ERROR] * Artifact updating: Repository ='releases:Releases'
does not allow updating artifact='/com/mydomain/myproject/1.0.1-RELEASE/proj-1.0.1-RELEASE-sources.jar'
[info] Activity release started:2019-05-28T17:40:16.980Z, stopped:
[info] Evaluate: id:nx-internal-ruleset, rule:RepositoryWritePolicy
[info] Evaluate: RepositoryWritePolicy
[info] Failed: RepositoryWritePolicy, failureMessage:Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/com/myproject/myproject/1.1.0/myproject-1.1.0-sources.jar'
[info] Failed: id:nx-internal-ruleset, failureCount:1
[info] repositoryReleaseFailed: id:myproject-1782, cause:com.sonatype.nexus.staging.StagingRulesFailedException: One or more rules have failed
[error] Failed to promote the repository
[error] Activity release started:2019-05-28T17:40:16.980Z, stopped:
[error] Failed: RepositoryWritePolicy, failureMessage:Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/com/myproject/myproject/1.1.0/myproject-1.1.0-sources.jar'
[error] java.lang.Exception: Failed to promote the repository
How can I fix it and be able to publish to the Central Repository?
Answer⚓︎
You are trying to update/republish an existing artifact.
Unfortunately Sonatype policy prohibits the removal or any other modification of artifacts after they have been released. In cases like this, we recommend that you check the values in your publishing job and verify that the version or name of the artifact is correct and it has not been already uploaded in your project.
You can check more information in detail here: Can I change, modify, delete, remove, or update a component on Central?
If you still are getting a 403 HTTP error and already reviewed that you are not trying to republish an existing artifact, please create a ticket for Central Support.