2

I have created proxy repos in Nexus 3 pointing to Nexus 2 hosted repositories. This is to snapshot and release repositories on Nexus 2. Now, on distributionManagement tag, I am using the proxy URLs and trying do a mvn clean deploy. I am getting the following error:

[INFO] Error deploying artifact: Failed to transfer file: http://nexus3url/repository/m2-snapshots/path/abc-1.1.4-SNAPSHOT.pom. Return code is: 405

Has anyone tried this?
David Medinets
  • 5,160
  • 3
  • 29
  • 42
stara
  • 153
  • 1
  • 2
  • 10

3 Answers3

12

As indicated in the comments, you can only deploy to Maven Hosted Repositories, not Proxies. This is by design.

DarthHater
  • 3,222
  • 25
  • 26
  • 2
    I've been browsing for a possible solution for the last 5 hours. No one mentions this anywhere else. – Mikayil Abdullayev Jun 02 '17 at 10:16
  • 1
    I'll see if I can get that made more explicit. – DarthHater Jun 05 '17 at 20:57
  • Why is this by design? Would you care to elaborate or provide a source? – Jonathan Komar Aug 03 '20 at 16:38
  • 1
    Proxies are meant to be a reflection of an upstream repository, so uploading to them doesn't really make sense. Hosted repositories are for uploading your own artifacts. A group would hold a combination of repositories. If you wanted to override an artifact, you'd upload it to a hosted repository, and set that repository to resolve in a group (higher in order) than your proxy. Does that make sense? – DarthHater Sep 08 '20 at 18:43
2

I faced same issue when I try to deploy application into nexus 3 repository. In my case the url is not proxy but path was wrong.

If you are trying to deploy snapshot version make sure url pointing to nexus snapshot repository location. if it is release version url should point to release repository.

Kishor K
  • 1,435
  • 12
  • 16
0

Your Nexus folder type should be host and try

mvn deploy 

command by using pipeline.

configFileProvider([configFile(fileId: '1880060f-32be-4888-a77d-eb046cab6981', variable: 'MAVEN_SETTINGS')]) {
sh "/jenkins_new/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.0/bin/mvn -s $MAVEN_SETTINGS deploy:deploy-file -DgroupId=net.cyc -DartifactId=${pom.artifactId} -Dversion=${pom.version} -DgeneratePom=true  -Dpackaging=jar -DrepositoryId=nbtnexus -Durl=https://dexus.connectcare.net/repository/maven-snapshots/  -DpomFile=pom.xml -Dfile=target/${pom.artifactId}-${pom.version}.${pom.packaging}"                    

    }
alepuzio
  • 1,382
  • 2
  • 28
  • 38
Gopi N
  • 1