如何将不开源的jar包安装到Maven私服,且在eclipse可用

J2EE 码拜 9年前 (2015-04-03) 1325次浏览 0个评论

一开始因为有两个第三方jar包需要额外导入到工程,然后我用如下mavne命令:
mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\fastjson-1.1.8.jar -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.8 -Dpackaging=jar  -DgeneratePom=true -DcreateChecksum=true
然后再pom.xml中配置依赖:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.8</version>
</dependency>
结果成功,可以达到眼前要求,就是本地仓库已经生成了所需jar包,但是只是在本地仓库.m2/respository里而已,没有共享到私服respository,导致其他同事maven dependencies中无法抓取对应的那两个jar包。

所以我改成使用:
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.8 -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\fastjson-1.1.8.jar -Durl=http://10.21.210.***:8081/nexus/content/repositories/releases/ -DrepositoryId=releases

在cmd中运行,SUCCESS,私服中确实也已经生成,但是eclipse中maven dependencies却无法生成相应的jar包,这是为什么?我要如何做才能让其他同事只需更新pom.xml文件,就可以得到我本地上传到私服仓库的jar包?求大神指教~

如何将不开源的jar包安装到Maven私服,且在eclipse可用
nexus的写权限帐号,发布到nexus
如何将不开源的jar包安装到Maven私服,且在eclipse可用
引用 1 楼 tianfang 的回复:

nexus的写权限帐号,发布到nexus

可以说详细一些吗?如果没有nexus写权限的账号,发布到nexus上不可以吗?
这是我maven install后的结果:
[ERROR] Failed to execute goal on project Gardenia_Bridging_Portal: Could not resolve dependencies for project com.gardenia.bridging:Gardenia_Bridging_Portal:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.alibaba:fastjson:jar:1.1.8, com.lewan:lewanPay:jar:1.0.0: Failure to find com.alibaba:fastjson:jar:1.1.8 in http://10.21.210.164:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1

如何将不开源的jar包安装到Maven私服,且在eclipse可用
30分
你要做的是:
  建立本地仓库;
  配置用户,特别是可以部署的用户
  部署到仓库,自己的和第三方的

参考  http://juvenshun.iteye.com/blog/349534
通过Nexus UI部署

如何将不开源的jar包安装到Maven私服,且在eclipse可用
引用 3 楼 tianfang 的回复:

你要做的是:
  建立本地仓库;
  配置用户,特别是可以部署的用户
  部署到仓库,自己的和第三方的

参考  http://juvenshun.iteye.com/blog/349534
通过Nexus UI部署

谢谢~  这帖子很详细,已经成功部署第三方jar包了~ 还发现个国内maven高手,全部分都给你啦


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明如何将不开源的jar包安装到Maven私服,且在eclipse可用
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!