《maven》上传jar到私服

1:在maven安装目录下conf/settings.xml认证--配置用户名密码

<server>
                <id>releases</id>
                <username>admin</username>
                <password>admin123</password>
            </server>
            <server>
                <id>snapshots</id>
                <username>admin</username>
                <password>admin123</password>
            </server>

《maven》上传jar到私服

2:在需要上传的项目pom.xml中配置jar上传路径

<distributionManagement>
      <repository>
          <id>releases</id>
          <url>http://localhost:8081/nexus/content/repositories/releases/</url>
      </repository>
       <snapshotRepository>
           <id>snapshots</id>
          <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
       </snapshotRepository>
  </distributionManagement>

《maven》上传jar到私服

3:执行命令上传jar到私服

      deploy

4:在http://localhost:8081/nexus/#welcome可以查看到自己已经发布的jar

《maven》上传jar到私服