正常maven依賴jar包的pom.xml寫法如下:
1
2
3
4
5
6
7
|
<!-- https://mvnrepository.com/artifact/ojdbc/ojdbc --> <!-- (參數(shù)一):下載到本地的ojdbc-10.2.0.4.0.jar包的真實(shí)存放路徑 --> < dependency > < groupId >ojdbc</ groupId >-----------------(參數(shù)二) < artifactId >ojdbc</ artifactId >-----------(參數(shù)三) < version >10.2.0.4.0</ version >------------(參數(shù)四) </ dependency > |
語法:
mvn install:install-file -Dfile=jar包的位置(參數(shù)一) -DgroupId=groupId(參數(shù)二) -DartifactId=artifactId(參數(shù)三) -Dversion=version(參數(shù)四) -Dpackaging=jar
注意必須在有pom文件的文件夾內(nèi)執(zhí)行才有效(項(xiàng)目內(nèi)的pom文件目錄內(nèi)也有效)
實(shí)例:mvn install:install-file -Dfile="C:\Users\zhaoyue\Desktop\commons\commons-io.jar" -DgroupId=org.apache.commons -DartifactId=commons-io -Dversion=2.6.0 -Dpackaging=jar
如果標(biāo)簽多的話,如下:
1
2
3
4
5
6
|
< dependency > < groupId >org.apache.hadoop</ groupId > < artifactId >hadoop-hdfs</ artifactId > < version >2.2.0</ version > < classifier >tests</ classifier > </ dependency > |
就加一個-D參數(shù)就可以了,如下:
mvn install:install-file -Dfile=hadoop-hdfs-2.2.0-tests.jar -DgroupId=org.apache.hadoop -DartifactId=hadoop-hdfs -Dversion=2.2.0 -Dclassifier=tests -Dpackaging=jar
到此這篇關(guān)于手動添加jar包進(jìn)Maven本地庫內(nèi)的方法的文章就介紹到這了,更多相關(guān)手動添加jar包進(jìn)Maven內(nèi)容請搜索服務(wù)器之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持服務(wù)器之家!
原文鏈接:https://www.cnblogs.com/nhdlb/p/11598174.html