maven 手動添加第三方的jar包

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

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

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

Xml代碼  收藏代碼flex

  1. <dependency>   spa

  2.    <groupId>net.sf.saxon</groupId>   xml

  3.    <artifactId>saxon-dom</artifactId>   blog

  4.    <version>9.0</version>   ip

  5. </dependency>  get

pom.xml配置完成後,再執行如下命令:it

 

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」

相關文章
相關標籤/搜索