Maven依赖私服Nexus迁移

2020-02-11  本文已影响0人  dongzhensong

以nexus版本 nexus-2.14.4-03-Bundle 为例:
注意:nexus3.x不适用本文。
备份前文件结构

nexus-2.14.4-03-Bundle
   - nexus-2.14.4-03
      - bin
      - config
      - ...
   - sonatype-work
      - nexus
         - ... 

压缩nexus-2.14.4-03-Bundle,发送到新的服务器,解压,将nexus的路径D:\nexus-2.14.4-03-Bundle\nexus-2.14.4-03\bin添加到path
默认端口为8081,启动前应先查看该端口是否被占用:

netstat -ano|findstr "8081"

如果被占用,可选择停掉占用该端口的进程。

安装nexus:

nexus install

启动nexus

nexus start

启动完成后再浏览器中访问 http://localhost:8081/nexus

显示:


image.png

标识启动成功。

默认用户名与密码为 admin admin123

在maven中配置私服
pom中配置

<!-- 仓库位置,允许更新快照 -->
    <repositories>
        <repository>
            <id>public</id>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <url>http://123.45.67.89:8081/nexus/content/groups/public/</url>
        </repository>
    </repositories>
    <!-- 发布快照仓库位置 -->
    <distributionManagement>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://123.45.67.89:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
上一篇 下一篇

猜你喜欢

热点阅读