(一). 搭建nexus服务器java
2. 打开压缩包,能够看到以下文件服务器
3. 启动console-nexus.bat,就会启动nexus服务器,访问http://localhost:8081/nexus/就能够获得nexus管理界面。app
(二). Maven:利用mvn deploy命令将jar包上传到nexus服务器url
1. 修改$HOME/setting.xml,在标签内增长一下内容spa
DEV
nexus
local_repositories
http://localhost:8081/nexus/content/groups/public/
true
true
2. 修改$HOME/setting.xml,在标签内增长一下内容code
releases
deployment
deployment123
3. 修改项目下的pom.xml,在标签内增长以下内容server
snapshots
Nexus Snapshot Repository
http://localhost:8081/nexus/content/repositories/snapshots
releases
Nexus Release Repository
http://localhost:8081/nexus/content/repositories/releases
4. 访问http://localhost:8081/nexus/,将releases仓库的Deployment Policy的只修改成Allow Redeploy,以下图xml
4. 在项目下执行mvn deploy命令,执行成功后,访问http://localhost:8081/nexus/content/repositories/releases/找到刚才上传成功的jar包get
mvn deploy:deploy-file -DgroupId=app.xxx -DartifactId=xxx -Dversion=1.0 -Dpackaging=jar -Dfile=D:\java\picture_server\target\xxx-1.0-SNAPSHOT.jar -Durl=http://localhost:8081/nexus/content/repositories/releases/ -DrepositoryId=releases
说明:
-Dversion:解压缩xxx-1.0-SNAPSHOT.jar,查看文件META-INF/MANIFEST.MF,找到Manifest-Version对应的项,切不可取pom.xml文件里面的版本值。