405 Method Not Allowed在部署到Nexus时发生。

huangapple go评论138阅读模式
英文:

405 Method Not Allowed when deploying artifact to Nexus

问题

我正在部署一个允许重新部署的构件到 Nexus 快照仓库,使用以下 Maven 命令:

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

但是我遇到了以下错误:

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
英文:

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

答案1

得分: 6

我从未见过将 mvn deploy:deploy-file 用于 nexus/repo/browse URL:browse 不应该用于部署文件,只应用于...浏览它们。

一个典型的调用示例如下:

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/

(将 repos-snapshots 替换为您给托管的快照库起的名称)

英文:

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=&lt;aGroup&gt; -DartifactId=&lt;anArtifactId&gt; -Dversion=x.y.z-SNAPSHOT \
  -DrepositoryId=&lt;repoId&gt; \
  -Durl==https://nexus.perque.com/content/repositories/repos-snapshots/

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

答案2

得分: 4

405 Method Not Allowed表示您的客户端尝试调用的HTTP方法(可能是POST)在这种情况下不被允许。URL可能是错误的,用于上传构件,https://nexus.perque.com/repo/browse。请改用快照URL,而不是https://nexus.perque.com/repo/browse。猜测应该类似于repository/maven-snapshots/。参考链接:https://mincong.io/2018/08/04/maven-deploy-artifacts-to-nexus/。

英文:

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/

huangapple
  • 本文由 发表于 2020年8月14日 22:21:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/63414621.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定