apache/maven · error · ArtifactDeployerException
Unable to deploy artifacts
Error message
Unable to deploy artifacts
What it means
DefaultArtifactDeployer.deploy wraps the Eclipse Resolver's DeploymentException in ArtifactDeployerException('Unable to deploy artifacts') whenever publishing produced artifacts to a remote repository fails at the transport or protocol level. The original exception (HTTP status, transfer error, deployment rules rejection) is attached as the cause, so the real reason must be read from getCause().
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactDeployer.java:56
*/
@Named
@Singleton
public class DefaultArtifactDeployer implements ArtifactDeployer {
@Override
public void deploy(@Nonnull ArtifactDeployerRequest request) {
requireNonNull(request, "request");
InternalSession session = InternalSession.from(request.getSession());
Collection<ProducedArtifact> artifacts = requireNonNull(request.getArtifacts(), "request.artifacts");
RemoteRepository repository = requireNonNull(request.getRepository(), "request.repository");
try {
DeployRequest deployRequest = new DeployRequest()
.setRepository(session.toRepository(repository))
.setArtifacts(session.toArtifacts(artifacts));
session.getRepositorySystem().deploy(session.getSession(), deployRequest);
} catch (DeploymentException e) {
throw new ArtifactDeployerException("Unable to deploy artifacts", e);
}
}
}
View on GitHub (pinned to e4093d4e12)
Solutions
- Inspect exception.getCause() (and its message/HTTP status) to identify the server-side rejection
- Verify credentials: settings.xml <server><id> must match the distributionManagement repository id, and the user must have deploy rights
- Check the distributionManagement URL points to the correct deploy endpoint (e.g. .../repository/maven-releases vs maven-snapshots) for the artifact's version
- If redeploying, enable redeployment on the repository or bump the version, since most release repos reject overwrite
Example fix
// before
session.getService(ArtifactDeployer.class).deploy(request);
// after
try {
session.getService(ArtifactDeployer.class).deploy(request);
} catch (ArtifactDeployerException e) {
throw new IllegalStateException('Deploy failed: ' + e.getCause().getMessage(), e);
} Defensive patterns
Strategy: try-catch
Try / catch
try {
session.getService(ArtifactDeployer.class).deploy(request);
} catch (ArtifactDeployerException e) {
Throwable cause = e.getCause();
// log cause.getMessage() (HTTP status / server rejection) and fail the deploy step
throw e;
} Prevention
- Verify settings.xml <server> ids match distributionManagement repository ids before releasing
- Check deploy rights and snapshot/release repository targeting with a dry-run or a small artifact
- Treat any cause mentioning 400/401/403 as configuration, not network, and fix credentials/URL first
When it happens
Trigger: session.getService(ArtifactDeployer.class).deploy(new ArtifactDeployerRequest(session, repository, artifacts)) where the deployment fails: 401/403 from the server, wrong repository URL, missing deployment rights, snapshot-to-release mismatch, or a file transfer error.
Common situations: distributionManagement url typo or pointing to a repo the user cannot write to; credentials not configured in settings.xml <server> with the repository id; trying to deploy a release artifact to a snapshot repository (or vice versa); OSSRH / Nexus / Artifactory rejecting redeployment of an existing artifact; proxy or TLS issues between the build and the server.
Related errors
- Error retrieving previous build number for artifact '" + art
- artifactId can neither be null, empty nor blank
- {} could not be retrieved from repository: {} due to an erro
- Failed to retrieve POM for " + artifact.getId() + ": " + e.g
- Unable to get dependency information: " + e.getMessage()
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/23bdced79ce2020c.
Report an issue: GitHub.