方法一:将jar文件注册到本地maven库
jar文件需要放到当前目录下,执行以下命令,设置 groupId,artifactId,version信息,方便项目pom引用。
mvn install:install-file -Dfile=xxx.jar -Dpackaging=jar -DgroupId=xxx -DartifactId=xxx -Dversion=x执行完毕,即可把jar装载到本地仓库,项目中可直接使用引入依赖如sqljdbc
mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
pom.xml在 dependencies 节点加入(需要与之前install的groupId等信息一致)
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>方法二:在pom文件中标明本地jar位置
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6-11.2.0.3.jar</systemPath>
</dependency>

本文介绍了两种方式来处理第三方库未托管在公共Maven仓库的情况。第一种方法是使用Maven命令将jar文件安装到本地仓库,并在pom.xml中添加依赖;第二种方法是在pom.xml中直接指定本地jar文件的位置。
5208

被折叠的 条评论
为什么被折叠?



