deploy工程到nexus

一、上传私服

1.下载要deploy的工程

2.修改该工程的pom.xml

3.添加maven仓库和deploy仓库

    <!-- 去此仓库找依赖 -->
    <repositories>
        <repository>
            <id>nexus</id>
            <name>nexus</name>
            <url>file:///C:/Users/bofeng/.m2/mavenResp</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
    <!-- 部署到此仓库 -->
    <distributionManagement>
        <snapshotRepository>
            <id>nexus</id>
            <name>Nexus Snapshot</name>
            <url>http://39.106.171.57:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
        <site>
            <id>nexus</id>
            <name>Nexus Sites</name>
            <url>dav:http://39.106.171.57:8081/repository/maven-snapshots/</url>
        </site>
    </distributionManagement>

4.修改maven的settings.xml

  <servers>
    <server>
      <id>nexus</id>
      <username>bofeng</username>
      <password>xxxxxx</password>
    </server>
  </servers>

5.进入到要deploy工程与pom.xml同级的目录,执行

mvn deploy

deploy成功

二、配置使用此私服

在parent工程的pom.xml加配置

    <repositories>
        <repository>
            <id>nexus</id>
            <name>Nexus Snapshot</name>
            <url>http://39.106.171.57:8081/repository/maven-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

猜你喜欢

转载自www.cnblogs.com/naixin007/p/12292147.html
今日推荐