maven 知识点总结 三 向nexus3私服上传jar包

原文地址:https://blog.csdn.net/u013887008/article/details/79429973

向nexus3私服上传jar包

一般向私服上传jar包有三种方法:

  • 直接浏览器
  • cmd模式
  • IDE集成环境

准备环境

1.创建3rd_part

使用默认用户admin/admin123登陆

这里写图片描述

点击左侧的repository\repositories后,在右侧点击create repository

这里写图片描述

然后选择maven2(hosted),填写如下

这里写图片描述

跳到首页后选择maven-public

这里写图片描述

3rd_part移到member中,即将33rd_partmaven-public管理,点击save

这里写图片描述

至此,创建仓库完成

2.创建3rd_part管理用户

创建用户: 用户名/密码-dev/dev123

这里写图片描述

直接浏览器

使用dev/dev123登陆,点击upload

这里写图片描述

填写上传jar包的信息后,点击upload

这里写图片描述

可以看到已经上传成功

这里写图片描述

cmd模式

1.复制一份settings.xmlsettings-private.xml,在settings-private.xml文件中加入节点server:


  deployment
  dev
  dev123

在命令行中输入

mvn deploy:deploy-file
-DgroupId=com.sjing.yjyuan
-DartifactId=fastjson-sj
-Dversion=1.0.1
-Dpackaging=jar
-Dfile=E:\installed\mavenRepository\fastjson-1.2.40.jar
-Durl=http://192.168.1*9.1*0:8081/repository/3rd_part/
-DrepositoryId=deployment
--settings E:\installed\mavenRepository\settings-private.xml

其中-Durl3rd_part仓库的地址

这里写图片描述

-DrepositoryId即为之前server节点中的属性id的值,--settings指定maven的setting文件,即

这里写图片描述

IDE集成环境

settings-private.xml中的servers节点加入


  nexus-release
  dev
  dev123


  nexus-snapshots
  dev
  dev123

在maven工程项目nexus-upload中的pom文件中加入



 
     
     nexus-release
     Nexus release Repository
     
     http://192.168.1*9.1*0:8081/repository/maven-releases/
 
 
     nexus-snapshots
     Nexus snapshots Repository
     
     http://192.168.1*9.1*0:8081/repository/maven-snapshots/
 

然后运行mvn deploy

可以在控制台

[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ nexus-upload ---
Downloading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/maven-metadata.xml
Uploading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/nexus-upload-1.0-20180303.072618-1.jar
Uploaded: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/nexus-upload-1.0-20180303.072618-1.jar (3 KB at 4.6 KB/sec)
Uploading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/nexus-upload-1.0-20180303.072618-1.pom
Uploaded: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/nexus-upload-1.0-20180303.072618-1.pom (4 KB at 9.6 KB/sec)
Downloading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/maven-metadata.xml
Uploading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/maven-metadata.xml
Uploaded: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/1.0-SNAPSHOT/maven-metadata.xml (773 B at 2.7 KB/sec)
Uploading: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/maven-metadata.xml
Uploaded: http://192.168.1*9.1*0:8081/repository/maven-snapshots/com/sijing/yjyuan/nexus-upload/maven-metadata.xml (287 B at 1.5 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.368 s
[INFO] Finished at: 2018-03-03T15:26:20+08:00
[INFO] Final Memory: 15M/250M
[INFO] ------------------------------------------------------------------------
  • 服中可以看到

这里写图片描述

你可能感兴趣的:(maven)