一.怎么在pom.xml中添加項目中libs下的jar呢,而不是從本地倉庫中添加?
方式一:
1、首先將要添加的jar包復制到項目中的libs文件夾下
2.然后在pom.xml中添加如下代碼:例如 htmlunit-2.21-OSGi.jar
<dependency>
<groupId>htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.21-OSGi</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/htmlunit-2.21-OSGi.jar</systemPath>
</dependency>
注意:上面的方法,試了一下,發現不行,不知道,為何,誰要是試了沒有問題,可以分享一下,使用的下面的方式,沒有問題
方式二:
1.通過命令將jar安裝到本地倉庫
例如:invenoUtil-1.1.jar
mvn install:install-file -DgroupId=com.inveno -DartifactId=invenoUtil -Dversion=1.1 -Dpackaging=jar -Dfile=C:\GitHub\mr_parent\parent\libs\invenoUtil-1.1.jar
例如:distribute-1.0.jar
mvn install:install-file -DgroupId=com.inveno -DartifactId=distribute-Dversion=1.0 -Dpackaging=jar -Dfile=C:\GitHub\mr_parent\parent\libs\distribute-1.0.jar
2.在pom.xml中配置
<dependency>
<groupId>com.inveno</groupId>
<artifactId>invenoUtil</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.inveno</groupId>
<artifactId>distribute</artifactId>
<version>1.0</version>
</dependency>