Maven 上傳本地包到倉庫 (來源於同事(gagahjt)的筆記本)


 

1:將本地jar包導入到自己的Maven倉庫

mvn install:install-file -Dfile=D:\\kaptcha-2.3.2.jar -DgroupId=com.google -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar


2: 上傳Maven包到私服

        mvn deploy:deploy-file -DgroupId=com.google.code -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar -Dfile=/Users/dxlau/Downloads/kaptcha-2.3.2.jar -Durl=http://10.169.0.215:8081/nexus/content/repositories/third-party -DrepositoryId=third-party

DgroupId和DartifactId構成了該jar包在pom.xml的坐標,項目就是依靠這兩個屬性定位。自己起名字也行。
Dfile表示需要上傳的jar包的絕對路徑。
Durl私服上倉庫的位置,打開nexus——>repositories菜單,可以看到該路徑。
DrepositoryId服務器的表示id,在nexus的configuration可以看到。
Dversion表示版本信息,怎樣得到一個jar包准確的版本呢?
解壓該包,會發現一個叫MANIFEST.MF的文件,這個文件就有描述該包的版本信息。
比如Manifest-Version: 1.0可以知道該包的版本了。

上傳成功后,在nexus界面點擊3rd party倉庫可以看到這包。

mvn deploy:deploy-file -DgroupId=org.apache.calcite -DartifactId=calcite-linq4j -Dversion=1.8.0 -Dpackaging=jar -Dfile=C:\\calcite-linq4j-1.8.0.jar -Durl=http://10.169.0.215:8081/nexus/content/repositories/third-party -DrepositoryId=third-party


  mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=C:\\ojdbc14-10.2.0.4.0.jar -Durl=http://10.168.0.49:8081/nexus/content/repositories/releases

 

擴展:

http://blog.csdn.net/woshixuye/article/details/8133050

 

致謝 gagahjt

 

 

************************************補充 2017-3-1***************************************************

一個jar 可能依賴對其它庫的引用,如果使用上面的方式進行上傳是無法表述出依賴關系的,所以要使用類似於下面的語句:

mvn deploy:deploy-file -DgroupId=org.a.b.c -DartifactId=mycomm -Dversion=1.0.2 -Dpackaging=jar -DpomFile=[path]\pom.xml  -Dfile=[path]\comms-1.0.2.jar -Durl=http://10.168.100.118:8081/nexus/content/repositories/releases/ -DrepositoryId=releases 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM