使用maven搭建工程時,難免要加載大量的第三方的jar包、zip包比較少用,而maven的官網提供的jar往往不能滿足需求,這時需要我們手動加載到我們本地或nexus私服的倉庫中。
1.加載jar包到本地 (以加載saxon-dom-9.0.jar為例)
首先在工程的pom.xml文件中加入
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>9.0</version>
- </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為例)
- <dependency>
- <groupId>com.adobe.flex.compiler</groupId>
- <artifactId>asdoc</artifactId>
- <version>3.2.0.3958</version>
- <classifier>template</classifier>
- </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