有时候有些包通过maven下载不下来,或者要把本地的应用jar配置本地maven仓库中供我们去使用。
转载
使用maven搭建工程时,难免要加载大量的第三方的jar包、zip包比较少用,而maven的欧洲杯足彩官网提供的jar往往不能满足需求,这时需要我们手动加载到我们本地或nexus私服的仓库中。
1.加载jar包到本地 (以加载saxon-dom-9.0.jar为例)
首先在工程的pom.xml文件中加入
- <dependency>
- <groupid>net.sf.saxongroupid>
- <artifactid>saxon-domartifactid>
- <version>9.0version>
- 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.compilergroupid>
- <artifactid>asdocartifactid>
- <version>3.2.0.3958version>
- <classifier>templateclassifier>
- 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”