您的位置:首页 > 其它

maven私服搭建与使用

2019-02-15 16:59 357 查看

maven私服搭建与使用

  1. 使用场景 :公司不能连接公网、公司内部jar组件的共享。

  2. nexus下载安装下载地址

    #解压
    shell>tar -zxvf nexus-2.14.5-02-bundle.tar.gz

    #在环境变量当中设置启动用户
    shell> vim /etc/profile

    #添加profile文件。安全起见不建议使用root用户,如果使用其它用户需要加相应权限
    export RUN_AS_USER=root

    *配置启动参数:
    shell> vim ${nexusBase}/conf/nexus.properties
    #端口号
    application-port=9999
    启动与停止nexus
    #启动
    shell> ${nexusBase}/bin/nexus start
    #停止
    shell> ${nexusBase}/bin/nexus stop
    登录nexus 界面
    地址:http://{ip}:9999/nexus/
    用户名:admin
    密码:admin123
    #防火墙关闭状态

  3. nexus 仓库介绍:

    3rd party:第三方仓库
    Apache Snapshots:apache 快照仓库
    Central: maven 中央仓库
    Releases:私有发布版本仓库
    Snapshots:私有 快照版本仓库
  4. 本地远程仓库配置:

    在本地远程仓库配置

<repositories>
<repository>
<id>nexus-public</id>
<name>my nexus repository</name>
<url>http://192.168.0.147:9999/nexus/content/groups/public/</url>
</repository>
</repositories>

在settins 文件中配置远程仓库镜像,但作用范围广了

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://192.168.0.147:9999/nexus/content/groups/public/</url>
</mirror>
  1. 发布项目至nexus远程仓库

    配置仓库地址

<distributionManagement>
<repository>
<id>nexus-release</id>
<name>nexus release</name>
<url>http://192.168.0.147:9999/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshot</id>
<name>nexus snapshot</name>
<url>http://192.168.0.147:9999/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

在settings 中设置server

<server>
<id>nexus-snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>nexus-release</id>
<username>deployment</username>
<password>deployment123</password>
</server>

执行deploy 命令

mvn deploy
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: