13

I am deploying an artifact to a Nexus snapshot repository that allows redeployment, using the maven command:

mvn deploy:deploy-file -Durl=https://nexus.perque.com/repo/browse
/pont-aeri -DrepositoryId=tomcat-nexus.devops-snapshots -DgroupId=com.pont.aeri.pastis -DartifactId=pastis -Dversion=0.0.1-SNAPSHOT -Dpackaging=zip  -Dfile=D:\Users\pastis\IdeaProjects\pastis\pastis-web\target\pastis.war

but I have this error:

rds/0.0.2/pastis.zip 405 Method Not Allowed
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (Sin

2 Answers2

6

I have never seen a mvn deploy:deploy-file to a nexus/repo/browse URL: browse should not be used for deploying files, only for... browsing them.

A typical call would be

mvn deploy:deploy-file \
  -Dfile=/path/to/a/file \
  -Dpackaging=jar -DgroupId=<aGroup> -DartifactId=<anArtifactId> -Dversion=x.y.z-SNAPSHOT \
  -DrepositoryId=<repoId> \
  -Durl==https://nexus.perque.com/content/repositories/repos-snapshots/

(Replace repos-snapshots by the name you gave to the hosted snapshot repositories)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
4

405 Method Not Allowed, means the http method that your client is trying to call (probably POST) in this case, is not allowed. The url, probably is wrong to upload the artifats, https://nexus.perque.com/repo/browse . Could you please use snapshot url instead of https://nexus.perque.com/repo/browse? Guess it should be something like repository/maven-snapshots/ . https://mincong.io/2018/08/04/maven-deploy-artifacts-to-nexus/

Imran
  • 1,732
  • 3
  • 21
  • 46
  • 1
    In my case, I simply forgot to add `/repository` to the url. So I had to use `https://server/repository/reponame/dir/file` instead of `https://server/reponame/dir/file`. – mefiX Jun 10 '21 at 11:39