maven 手動添加第三方的jar包


使用maven搭建工程時,難免要加載大量的第三方的jar包、zip包比較少用,而maven的官網提供的jar往往不能滿足需求,這時需要我們手動加載到我們本地或nexus私服的倉庫中。

1.加載jar包到本地 (以加載saxon-dom-9.0.jar為例)

首先在工程的pom.xml文件中加入

Xml代碼   收藏代碼
  1. <dependency>   
  2.    <groupId>net.sf.saxon</groupId>   
  3.    <artifactId>saxon-dom</artifactId>   
  4.    <version>9.0</version>   
  5. </dependency>  

pom.xml配置完成后,再執行以下命令:

 

mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dversion=9.0 -Dpackaging=jar -Dfile=/home/ubuntu/saxon-dom-9.0.jar

說明:-Dfile指第三方jar的路徑,其它的注意要確保maven命令中groupId、artifactId、version與pom.xml中的配置相同,-Dpackaging表示加載的文件類型

2.加載zip包到本地(以加載asdoc-3.2.0.3958-template.zip為例)

Xml代碼   收藏代碼
  1. <dependency>  
  2.         <groupId>com.adobe.flex.compiler</groupId>  
  3.         <artifactId>asdoc</artifactId>  
  4.         <version>3.2.0.3958</version>  
  5.         <classifier>template</classifier>  
  6. </dependency>  
 

pom.xml配置完成后,再執行以下命令:

mvn install:install-file -DgroupId=com.adobe.flex.compiler -DartifactId=asdoc -Dversion=3.2.0.3958 -Dclassifier=template -Dpackaging=zip -Dfile=/home/ubuntu/asdoc-3.2.0.3958-template.zip

說明:加載zip包與加載jar基本相同,注意加載文件的類型“-Dpackaging”

 

http://blog.csdn.net/shuhuai007/article/details/7564931


免責聲明!

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



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