1.下载nexus
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz
2.解压,会出现两个目录,nexus-2.11.2-03是服务 sonatype-work是私有库目录
mkdir nexustar -zxvf nexus-2.11.2-03-bundle.tar.gz -C ./nexus
3.修改配置,在nexus-2.11.2-03/bin目录下修改nexus文件
NEXUS_HOME=“安装目录”RUN_AS_USER=xxx
4.修改端口,nexus-2.11.2-03/conf修改nexus.properties文件
application-port=XXX
5.启动
./bin/nexus startStarting Nexus OSS...Started Nexus OSS.
6.修改密码
admin:该用户拥有Nexus的全部权限,默认密码为admin123。deployment:该用户能够访问Nexus,浏览仓库内容、搜索、上传部署构件,但是不能对Nexus进行任何配置,默认密码为deployment123。anonymous:该用户对应了所有未登录的匿名用户,它们可以浏览仓库并进行搜索。
7.上传Jar包
参考:
登录之后可以看到如下仓库
<1>如果上传的是第三方的jar包
在图中填入相应的jar包的信息就可以了
同时在maven的setting.xml文件中配置
nexus-releases admin xxxx nexus-snapshots admin xxxx
以及
mynexus central My Nexus http://XXX/nexus/content/repositories/thirdparty/
<2>上传snapshot包
在工程的pom文件中配置
nexus-releases Nexus Release Repository http://XXX/nexus/content/repositories/releases/ nexus-snapshots Nexus Snapshot Repository http://XXX/nexus/content/repositories/snapshots/
同时在maven的setting.xml文件中配置
nexus nexus-releases http://nexus-releases true true nexus-snapshots http://nexus-snapshots true true nexus-releases http://nexus-releases true true nexus-snapshots http://nexus-snapshots true true nexus
然后在项目下运行,就会生成snapshot包
mvn deploy