Maven构建找不到Oracle

时间:2019-03-17 19:22:53

标签: oracle maven

我正在将Maven项目的数据库从MySQL切换到Oracle。我的pom.xml中有此依赖项:

<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>

但是IntelliJ的maven视图显示了对该依赖项的红色扭曲,并且 mvn clean install 给了我:

Could not resolve dependencies for project com.example:polls:jar:0.0.1-SNAPSHOT: Failure to find com.oracle:ojdbc6:jar:11.2.0.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

因此,根据this的建议,我做了一个强制操作(mvn clean install -U)。但这给了我

Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.pom
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2.0.1.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.jar

...即使我的.m2确实包含该依赖项:

enter image description here

那么为什么我的项目无法构建?是否有某些原因无法通过Maven Central访问Oracle jar?

1 个答案:

答案 0 :(得分:0)

事实证明,需要从“ Oracle Maven存储库”中获取Oracle JDBC驱动程序。上有lotsguidance,我想我一开始就错过了。也可以directly下载它们。