I'm trying to push a zipped bundle on nexus, which our hosted Nexus doesn't accept. We're building a release based on a git tag-name, e.g. 1.0.0
Maven command in our Jenkinsfile:
...
steps {
sh "mvn -pl distribution deploy:deploy-file -Drevision=$TAG_NAME -DgroupId=com.group.project -DartifactId=project-bundled -Dversion=$TAG_NAME -Dpackaging=zip -Dfile=target/distribution-$TAG_NAME.zip -Durl=https://hosted.com/nexus/repositories/project-releases -DrepositoryId=project-releases"
}
...
Here's the output from Jenkins:
[INFO]
[INFO] --------------------< com.group.project:distribution >---------------------
[INFO] Building Distribution 1.0.0
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy-file (default-cli) @ distribution ---
[INFO] Uploading to project-releases: https://hosted.com/nexus/repositories/project-releases/com/group/project/project-bundled/1.0.0/project-bundled-1.0.0.zip
[INFO] Uploading to project-releases: https://hosted.com/nexus/repositories/project-releases/com/group/project/project-bundled/1.0.0/project-bundled-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.460 s
[INFO] Finished at: 2022-01-26T15:59:38Z
[INFO] ------------------------------------------------------------------------
[INFO] [jenkins-event-spy] Generated /home/jenkins/agent/workspace/sxp-50Hertz-SMB_1.0.0/sidesystem@tmp/withMavene19bbfdf/maven-spy-20220126-....log
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project distribution: Failed to deploy artifacts: Could not transfer artifact com.group.project:project-bundled:zip:1.0.0 from/to project-releases (https://hosted.com/nexus/repositories/project-releases): transfer failed for https://hosted.com/nexus/repositories/project-releases/com/group/project/project-bundled/1.0.0/project-bundled-1.0.0.zip, status: 405 Method Not Allowed -> [Help 1]
Here's also the distributionManagement part in the pom.xml, but the usual mvn deploy
command works
<distributionManagement>
<repository>
<id>project-releases</id>
<name>project-releases</name>
<url>https://hosted.com/nexus/repository/project-releases</url>
</repository>
<snapshotRepository>
<id>project-snapshots</id>
<name>project-snapshots</name>
<url>https://hosted.com/nexus/repository/project-snapshots</url>
</snapshotRepository>
</distributionManagement>