{"record":{"id":"23bdced79ce2020c","repo":"apache/maven","slug":"unable-to-deploy-artifacts","errorCode":null,"errorMessage":"Unable to deploy artifacts","messagePattern":"Unable to deploy artifacts","errorType":"exception","errorClass":"ArtifactDeployerException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactDeployer.java","lineNumber":56,"sourceCode":" */\n@Named\n@Singleton\npublic class DefaultArtifactDeployer implements ArtifactDeployer {\n\n    @Override\n    public void deploy(@Nonnull ArtifactDeployerRequest request) {\n        requireNonNull(request, \"request\");\n        InternalSession session = InternalSession.from(request.getSession());\n        Collection<ProducedArtifact> artifacts = requireNonNull(request.getArtifacts(), \"request.artifacts\");\n        RemoteRepository repository = requireNonNull(request.getRepository(), \"request.repository\");\n        try {\n            DeployRequest deployRequest = new DeployRequest()\n                    .setRepository(session.toRepository(repository))\n                    .setArtifacts(session.toArtifacts(artifacts));\n\n            session.getRepositorySystem().deploy(session.getSession(), deployRequest);\n        } catch (DeploymentException e) {\n            throw new ArtifactDeployerException(\"Unable to deploy artifacts\", e);\n        }\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":60,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactDeployer.java#L38-L60","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsession.getService(ArtifactDeployer.class).deploy(request);\n\n// after\ntry {\n    session.getService(ArtifactDeployer.class).deploy(request);\n} catch (ArtifactDeployerException e) {\n    throw new IllegalStateException('Deploy failed: ' + e.getCause().getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    session.getService(ArtifactDeployer.class).deploy(request);\n} catch (ArtifactDeployerException e) {\n    Throwable cause = e.getCause();\n    // log cause.getMessage() (HTTP status / server rejection) and fail the deploy step\n    throw e;\n}","preventionTips":["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"],"tags":["maven","deployment","remote-repository","authentication"],"backgroundTag":"artifact-deploy-failed","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}