jdk,maven不多说
下载Nexus Repository Manager 2 OSShttps://help.sonatype.com/repomanager2/download
土豪或者公司也可以去下PRO不解释
上传并移动到/home/data/nexus不解释
上传:https://blog.csdn.net/oLengYueHun/article/details/88798987
基础命令:https://blog.csdn.net/oLengYueHun/article/details/88796736
下面将如何安装
解压
$: tar -zxvf nexus-2.14.12-02-bundle.tar.gz
目录结构:
更改访问用户:
vi nexus-2.14.12-02/bin/nexus
将#RUN_AS_USER
=改为RUN_AS_USER=root
开放8081
firewall-cmd --zone=public --add-port=8081/tcp --permanent
重启防火墙
firewall-cmd --reload
在bin目录下启动nexus
./nexus start
浏览器打开远程地址
https://192.168.1.110:8081/nexus
右上角登录
username:admin
password:admin123
点击Repositories,将列表中所有Type为proxy 的项目的 Configuration 中的
Download Remote Indexes 设置为True
将Releases仓库的Deployment Policy设置为 Allow ReDeploy
手工添加jar:
3rd party–>GAV:from pom
filename:鼠标选择jar包
upload artifact(s)
配置本地项目引用私服
修改maven配置文件settings.xml
<!--**********************************-->
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<!--**********************************-->
配置Maven从Nexus下载构件
在POM中配置Nexus私服,这样的配置只对当前的Maven项目有效。
<!--指定Nexus的构件仓库-->
<repositories>
<repository>
<id>public</id>
<name>Team Maven Repository</name>
<url>http://192.168.1.11:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!--指定Nexus的插件仓库-->
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Team Maven Repository</name>
<url>http://192.168.1.110:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!---------------------------------------------->
项目pom.xml配置
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.1.110:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.1.110:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>