正常maven依賴jar包的pom.xml寫法如下:
<!-- https://mvnrepository.com/artifact/ojdbc/ojdbc -->
<!-- (參數一):下載到本地的ojdbc-10.2.0.4.0.jar包的真實存放路徑 --> <dependency> <groupId>ojdbc</groupId>-----------------(參數二) <artifactId>ojdbc</artifactId>-----------(參數三) <version>10.2.0.4.0</version>------------(參數四) </dependency>
語法:
mvn install:install-file -Dfile=jar包的位置(參數一) -DgroupId=groupId(參數二) -DartifactId=artifactId(參數三) -Dversion=version(參數四) -Dpackaging=jar
注意必須在有pom文件的文件夾內執行才有效(項目內的pom文件目錄內也有效)
實例: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
如果標簽多的話,如下:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>2.2.0</version>
<classifier>tests</classifier>
</dependency>
就加一個-D參數就可以了,如下:
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