系统:LINUX
JDK:已安装
Maven:已安装
Nexus
Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问。
一、搭建
1.下载nexus
https://www.sonatype.com/download-oss-sonatype
2.上传到/root
3.解压
tar -zxvf nexus-3.12.1-01-unix.tar.gz -C /usr/local/
4.修改配置文件
♦端口
vim /usr/local/nexus-3.12.1-01/etc/nexus-default.properties
♦防火墙
vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
5.登陆浏览器打开
http://192.168.56.102:8081/ 账号admin 密码 admin123 System Requirement: max file descriptors [4096] likely too low, increase to at least [65536].
6.修改ulimit
vim /etc/security/limits.conf 新增 * soft nofile 65535 * hard nofile 65535
7.设置开机自启动
二、使用
1.仓库类型
proxy:代理仓库,用于代理远程仓库group:仓库组,通常包含了多个代理仓库和宿主仓库,在项目中只要引入仓库组就可以下载到代理仓库和宿主仓库中的包hosted:宿主仓库,内部项目、付费jar releases 发布内部release版本的仓库 snapshots 发布内部snapshots版本的仓库 third 自建第三方jar
2.配置代理
选择阿里云http://maven.aliyun.com/nexus/content/groups/public/
3.本地maven配置
releases admin admin123 snapshots admin admin123 repo1 * Human Readable Name http://39.98.204.96:8081/repository/bjaxyh/ osc central http://maven.aliyun.com/nexus/content/repositories/central osc_thirdparty thirdparty http://maven.aliyun.com/nexus/content/repositories/central nexus local private nexus http://39.98.204.96:8081/repository/bjaxyh/ true false nexus local private nexus http://39.98.204.96:8081/repository/bjaxyh/ true false osc true osc http://maven.aliyun.com/nexus/content/repositories/central osc http://maven.aliyun.com/nexus/content/repositories/central
4.修改pom
releases Ruizhi Release Repository http://192.168.56.101:8081/repository/maven-releases/ snapshots Ruizhi Snapshot Repository http://192.168.56.101:8081/repository/maven-snapshots/
5.测试是否nexus搭建成功
pom添加本地没有的依赖,看nexus会不会代理
mvn deploy 看是否成功推送至nexus三、nexus图片观赏
四、pom.xml
4.0.0 axyh_springboot axyh_springboot jar com.anxinyiheng axyh_parent 0.0.1-SNAPSHOT UTF-8 releases releases Repository http://39.98.204.96:8081/repository/maven-releases/ snapshots snapshots http://39.98.204.96:8081/repository/maven-snapshots/ org.springframework.boot spring-boot-maven-plugin repackage