Maven deploy "405 Method Not Allowed" (PUT) in CI
maven-deploy-plugin issued an HTTP PUT to upload the artifact and the server answered 405 Method Not Allowed. The endpoint accepts reads but not writes: you are deploying to a proxy/group URL or a path that does not allow uploads.
What this error means
deploy fails with "Failed to deploy artifacts: Could not transfer artifact ... status code: 405, reason phrase: Method Not Allowed (405)". GET-based resolution from the same host works.
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project app:
Failed to deploy artifacts: Could not transfer artifact com.example:app:jar:1.0.0
from/to nexus (https://nexus.example.com/repository/maven-public/):
status code: 405, reason phrase: Method Not Allowed (405) -> [Help 1]Common causes
Deploying to a read-only group/proxy repository
A repository "group" or proxy URL (often maven-public) aggregates reads and does not accept PUT uploads, so the server returns 405.
A misconfigured distributionManagement URL
The upload URL points at a path the server does not expose for writes, so the PUT is not allowed.
How to fix it
Deploy to a hosted, writable repository URL
Target the hosted releases/snapshots repository, not the group/proxy URL used for resolution.
<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>Verify the endpoint accepts uploads
Confirm with the repository admin which URL is hosted and writable, then point the deploy goal at it.
How to prevent it
- Deploy only to hosted repositories, never group/proxy URLs.
- Keep separate URLs for resolution and for upload.
- Validate distributionManagement URLs with a snapshot deploy first.