maven 私服搭建-nexus

1.下载nexus

nexus-2.14.5-02-bundle.tar.gz

2.解压

tar -zxvf nexus-2.14.5-02-bundle.tar.gz

解压完毕后会出现两个文件夹:

  • nexus-2.14.5-02 源码包
  • sonatype-work 仓库

3.在环境变量当中设置启动用户

vim /etc/profile

添加profile文件。安全起见不建议使用root用户,如果使用其它用户需要加相应权限 (以root为例)

export RUN_AS_USER=root

4.配置启动参数

vim nexus-2.14.5-02/conf/nexus.properties
#端口号
application-port=8081
#仓库地址
nexus-work=${bundleBasedir}/../sonatype-work/nexus

5.启动与停止nexus

#启动
shell> nexus-2.14.5-02/bin/nexus start
#停止
shell> nexus-2.14.5-02/bin/nexus stop

6.登录nexus 界面

地址:http://{ip}:8081/nexus/
用户名:admin
密码:admin123

6.1 修改proxy类型仓库配置




7.repositories介绍

看下基础结构

7.1 type几种类型

  • group 组-可以把多个仓库组成一个大的仓库
  • hosted 私有化仓库-我们本地上传的jar
  • proxy 代理仓库-从互联网上下载下来的jar

7.1.1 如何添加一个分组


把需要组成一个组的仓库移动到左边,排好序,jar包搜索顺序事按照从下至下的顺序查找的,点击保存即可。

7.1.2 hosted仓库介绍

hosted仓库分为三种:

  • 3rd party 第三方jar-例如其他公司直接提供给我们的sdk
  • Snapshots 本地项目jar包快照版
  • Releases 本地项目jar包正式版(注意此仓库版本号带Snapshots 无法上传)

8.本地maven从私服配置上传下载

8.1 下载

8.1.1 配置快照地址

直接配置至组的访问地址即可

<mirror>
    <id>ganinfo</id>
    <name>ganinfo</name>
	<mirrorOf>*</mirrorOf>
   <url>http://xxxx:8081/nexus/content/groups/ganinfo/</url>
</mirror>

8.2 上传

配置setting.xml

   <server>
      <id>iotreleases</id>
      <username>deployment</username>
      <password>123456</password>
    </server>
    <server>
      <id>iotsnapshots</id>
      <username>deployment</username>
      <password>123456</password>
    </server>
配置pom文件
<distributionManagement>
        <repository>
            <id>iotreleases</id>
            <name>iot releases</name>
            <url>http://xxxx:port/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>iotsnapshots</id>
            <name>iot snapshots</name>
            <url>http://xxxx:port/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值