使用Sonatype Nexus时,Grails Release插件maven-deploy命令失败401错误

时间:2014-09-27 10:45:34

标签: maven grails nexus

  • 操作系统:Windows7
  • Grails:2.4.3
  • Sonatype Nexus:2.9.2-01
  • Maven:3,2,3

这个问题解决了!

原因是错字。

在BuildConfig.groovy

之前:

grails.project.repos.myRepo.url = "http://localhost:8081/nexus/content/repositories/snapshots"
grails.project.repos.myRepo.type = "maven"
grails.project.repos.myRepo.username = "deployment"
grails.project.repos.myRepo.password = "deployment123"

后:

grails.project.repos.snapshots.url = "http://localhost:8081/nexus/content/repositories/snapshots"
grails.project.repos.snapshots.type = "maven"
grails.project.repos.snapshots.username = "deployment"
grails.project.repos.snapshots.password = "deployment123"

我忘了更改仓库ID。

如果忘记其中任何一个,请返回401。

非常感谢!


我决定在Sonatype Nexus上托管我的开发插件作为本地Maven存储库,以检查实际安装在独立Glails应用程序中时的插件行为。

首先,我安装了Maven和Sonatype Nexus。

的Maven

下载zip并将其解压缩到C盘下方。

C:\apache-maven-3.2.3

接下来,我创建了两个系统属性,并将M2连接到Path。

M2_HOME
C:\apache-maven-3.2.3

M2
%M2ZHOME%\bin

Path tail
~~~~~~~~%M2%;

Sonatype Nexus

下载zip并将其解压缩到C盘下方。

C:\nexus-2.9.2-01-bundle

然后执行install and start命令,nexus webapp成功启动。


接下来,我编写了发布插件配置的BuildConfig.groovy。

grails.project.repos.snapshots.url = "http://localhost:8081/nexus/content/repositories/snapshots"
grails.project.repos.myRepo.type = "maven"
grails.project.repos.myRepo.username = "deployment"
grails.project.repos.myRepo.password = "deployment123"
grails.project.repos.default = "snapshots"

“快照”是从Sonatype Nexus开始提供的存储库。


最后,我执行maven-deploy命令并在下面收到错误消息。

| Error Error deploying artifact: Error deploying artifact 'org.grails.plugins:myplugin:zip': Error deploying artifact: Failed to transfer file: http://loca
lhost:8081/nexus/content/repositories/snapshots/org/grails/plugins/myplugin/
0.1/myplugin-0.1.zip. Return code is: 401
| Error Have you specified a configured repository to deploy to (--repository ar
gument) or specified distributionManagement in your POM?

我错了什么?

1 个答案:

答案 0 :(得分:1)

Google搜索Sonatype Nexus 401为您提供答案:http://blog.sonatype.com/2010/11/what-to-do-when-nexus-returns-401/