cmd输入命令

 mvn deploy:deploy-file -DgroupId=com.xy.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=E:\ojdbc14.jar -Durl=http://localhost:9090/nexus-2.2-01/content/repositories/thirdparty/ -DrepositoryId=thirdparty

 

可能出现问题的解决:

 

使用mvn deploy发布到远程仓库时报错 Return code is: 400

 

原因:

 

1.nexus的repository分三种类型:Hosted、 Proxy和Virtual,另外还有一个repository group(仓库组)用于对多个仓库进行组合。部署的时候只能部署到Hosted类型的仓库中,如果是其他类型就会出现这个400错误。

 

2.默认情况下部署构件到Releases仓库中有时也会出现400错误,这个原因就像上面提到的那样,Nexus中 Releases仓库默认的Deployment Policy是“Disable Redeploy”,
所以无论你在settings.xml文件中将server的username设置为deployment还是使用admin都是无 法部署的,就会出现这个400错误。解决:到nexus后台把 Deployment Policy 设置成Allow Redeploy,

 

3.Nexus中 Releases仓库Respository PolicySnapshot是“Release”
Snapshot仓库Respository PolicySnapshot是“Snapshot” 如果设置反了或错了也是无法部署的。

 

4.如果你Snapshot可以发布,但是releases却发布不了,可能是<version>1.0-SNAPSHOT</version>类似这样的,version中包含了-SNAPSHOT,所以release发布不了,

 

也会返回400错误。

 

 

Return code is: 401, ReasonPhrase: Unauthorized 没有被授权操作仓库
   检查仓库的设置,以及用户名密码配置。

 

 上传jar

mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=build-helper-maven-plugin -Dversion=1.9.1 -Dpackaging=jar -Dfile=C:\Users\xxxx\Desktop\build-helper-maven-plugin-1.9.1.jar -Durl=http://xxxx:8081/nexus/content/repositories/EMS/ -DrepositoryId=EMS

 

 上传源码包

mvn deploy:deploy-file -DgroupId=org.ems -DartifactId=openoffice-jodconverter -Dversion=3.0.5 -Dpackaging=jar  -Dclassifier=sources -Dfile=C:\Users\username\Desktop\openoffice-jodconverter-3.0.5-sources.jar -Durl=http://XXXXX:8081/nexus/content/repositories/EMS/ -DrepositoryId=EMS

 

 

posted on 2016-09-02 13:48  七月逆流  阅读(9063)  评论(0编辑  收藏  举报