deploy工程到nexus

安稳与你 提交于 2020-02-10 19:46:48

一、上传私服

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>

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!