一、使用最高权限登录nexus
输入默认账号:admin 密码:admin123
二、创建第三方私有maven仓库
选择导航栏的齿轮,点击左侧菜单 Repositories,点击Create repository
选择 maven2 hosted
Name 输入 3rdParty ,Hosted选择Allow redeploy,点击 Create repository
查看到 3rdParty ,创建成功!~
三、修改maven 插件
修改/conf/settings.xml文件
找到servers标签 增加
<server><!-- nexus3 -->
<id>3rdParty</id>
<username>admin</username>
<password>admin123</password>
</server>
四、jar包上传nexus
打开cmd控制台,输入如下:
mvn deploy:deploy-file -DgroupId=com.baidu.ueditor -DartifactId=ueditor -Dversion=1.1.2 -Dpackaging=jar -Dfile=D:\ueditor-1.1.2.jar -Durl=http://localhost:8081/repository/3rdParty/ -DrepositoryId=3rdParty
成功!~
对控制台输入内容的解析
<dependency>
<groupId>com.baidu.ueditor</groupId>
<artifactId>ueditor</artifactId>
<version>1.1.2</version>
</dependency>
mvn deploy:deploy-file -DgroupId=com.baidu.ueditor -DartifactId=ueditor -Dversion=1.1.2 -Dpackaging=jar -Dfile=D:\ueditor-1.1.2.jar -Durl=http://localhost:8081/repository/3rdParty/ -DrepositoryId=3rdParty
DgroupId: 对应pom.xml中 <groupId>
DartifactId: 对应pom.xml中 <artifactId>
Dversion: 对应pom.xml中 <version>
Dpackaging: 包的类型
Dfile: 包所在路径
Durl: nexus的3rdParty路径(可以在nexus中找到3rdParty私有仓库,在url列点击copy按钮)
DrepositoryId: 选择仓库