Nexus "PUT ... 405 Method Not Allowed" deploying to a group/proxy in CI
Nexus group and proxy repositories are read-only aggregations. A PUT to them returns 405 Method Not Allowed. Deploys must target a hosted repository; use the group only for resolving dependencies.
What this error means
The deploy PUT fails with "status code: 405, reason phrase: Method Not Allowed" even though the same URL works fine for downloads and dependency resolution.
[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-public/): status code: 405,
reason phrase: Method Not Allowed (405)Common causes
Deploying to a group repository
maven-public (and similar group repos) merge several repos for reads only. They cannot accept writes, so PUT returns 405.
Deploying to a proxy repository
Proxy repos mirror an upstream and are read-only. Uploads to them are rejected with 405 the same way.
How to fix it
Deploy to a hosted repository
- Resolve dependencies from the group repo (maven-public).
- Deploy artifacts to a hosted repo (maven-releases or maven-snapshots).
- Never point distributionManagement at a group or proxy URL.
<!-- reads from the group, writes to hosted -->
<repositories>
<repository>
<id>nexus</id>
<url>https://nexus.example.com/repository/maven-public/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>nexus</id>
<url>https://nexus.example.com/repository/maven-releases/</url>
</repository>
</distributionManagement>Check the repository type in Nexus
In Nexus the repositories list shows Type = group / proxy / hosted. Only hosted accepts deploys.
How to prevent it
- Use group repos for reads, hosted repos for writes.
- Verify the target repository Type is hosted before deploying.
- Keep resolve and deploy URLs distinct in your build config.