maven不能加载ojdbc14.jar的解决方法

首先下载ojdbc14-10.2.0.2.jar这个包,然后在cmd下输入以下

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.2 -Dpackaging=jar -Dfile=C:ojdbc14-10.2.0.2.jar

这里的-Dfile是指本地存放ojdbc14-10.2.0.2.jar的位置,然后再把C:ojdbc14-10.2.0.2.jar这个包复制到maven管理的本地库中,本人的maven管理库的路径C:Documents and Settingsadmin.m2 epositorycomoracleojdbc1410.2.0.2,所以把刚刚编译好的ojdbc14-10.2.0.2.jar放到上面路径

其次中pom.xml中写入

<dependency>
   <groupId>com.oracle</groupId>
   <artifactId>ojdbc14</artifactId>
   <version>10.2.0.2</version>
   <scope>provided</scope>
  </dependency>

Maven中的dependency的scope作用域详解

1test范围指的是测试范围有效,在编译和打包时都不会使用这个依赖

2compile范围指的是编译范围有效,在编译和打包时都会将依赖存储进去

3provided依赖:在编译和测试的过程有效,最后生成war包时不会加入,诸如:servlet-api,因为servlet-apitomcatweb服务器已经存在了,如果再打包会冲突 

4runtime在运行的时候依赖,在编译的时候不依赖 

原文地址:https://www.cnblogs.com/huanlingjisi/p/8688121.html