maven nexus上传文件jar包(使用deploy来部署)

使用maven deploy部署

  1. 配置settings.xml文件,设置用户名和密码。
  2. 配置servers节点,这里的id就是别名,等会在项目的pom文件需要使用,其他两个参数就是用户名和密码。
  3. 配置信息如下图所示。
    在这里插入图片描述
配置信息
  <servers>
     <server>
      <id>Imobpay</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
	<server>
      <id>ImobpaySnapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>

配置pom文件

  1. 在项目的pom文件设置distributionManagement节点。
  <distributionManagement>
  
    <snapshotRepository>//这个节点表示是快照版本。
      <id>Imobpay</id>//这个ID就是上面settings.xml里面配置的server的id的名字,必须和上面的保持一致。
      <name>Nexus Snapshots Repository</name>  //名字可以随意。
      <url>http://xxxxxxx:0000/nexus/content/repositories/snapshots/</url>// 这个是你需要上传的仓库地址,就是自己新建的仓库地址。
    </snapshotRepository>
    //repository表示发布版本。
    <repository>
      <id>Imobpay</id>
      <name>Nexus Release Repository</name>
      <url>http://xxxxxxx:9090/nexus/content/repositories/Imobpay/</url>
    </repository>
  </distributionManagement>

执行命令

mvn  deploy -Dmaven.test.skip=true

猜你喜欢

转载自blog.csdn.net/u010316188/article/details/89084036