maven私服上傳jar文件

  1. 我們知道,每個公司都會有自己的工具包或公共包,這種包就可以上傳到公司的maven私服,就不用每個人都去同步開發包了。那麼,怎麼把本地項目打包併發布到私服呢?按照如下步驟就可以輕鬆完成。  

1.  在setting.xml文件中增加如下內容:

  1. <servers>  
  2.    <server>  
  3.      <!-- 發佈的位置在POM中配置,以ID爲關聯,有很多公用的信息需要配置在POM文件裏,最佳實踐是定義一個公司級別的root pom -->  
  4.      <id>nexus</id>  
  5.      <username>admin</username>  
  6.      <password>admin123</password>  
  7.    </server>  
  8.    <server>  
  9.      <id>nexus-snapshots</id>  
  10.      <username>admin</username>  
  11.      <password>admin123</password>  
  12.    </server>  
  13. <server>  
  14.      <id>thirdparty</id>  
  15.      <username>admin</username>  
  16.      <password>admin123</password>  
  17.    </server>  
  18.  </servers>  


2. 在項目的pom.xml文件中增加如下內容

  1.  <distributionManagement>  
  2. <repository>  
  3.     <id>nexus</id>  
  4.     <name>local private nexus</name>  
  5.     <url>http://192.168.xx.xx:8081/nexus/content/groups/public</url>  
  6. </repository>  
  7. <snapshotRepository>  
  8.     <id>nexus-snapshots</id>  
  9.     <name>local private nexus snapshots</name>  
  10.     <url>http://192.168.xx.xx:8081/nexus/content/groups/public-snapshots</url>  
  11. </snapshotRepository>  
  12.  </distributionManagement>   
  1. <span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> </span>  

3.  在項目的 maven bulider中的Goals輸入如下內容

deploy:deploy-file -DgroupId=com.ivifi.tools -DartifactId=ivifi.tools -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=D:\git\tools\visn.tools\target\ivifi.tools-1.0-SNAPSHOT.jar  -Durl=http://192.168.xx.xx:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章