在linux下用nexus搭建maven私仓

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>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值