問題復現步驟:
1、在pom.xml里面添加ojdbc14的依賴,代碼如下:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
</dependency>
2、執行mvn install報如下錯誤:
[ERROR] Failed to execute goal on project ssm_domain: Could not resolve dependencies for project com.miyoo.ssm:ssm_domain:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc14:jar:5.0.2.RELEASE in http://maven.aliyun.com/nexus/content/reposi
tories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1]
問題分析:
因為oracle的ojdbc.jar是收費的,所以maven的中央倉庫中沒有這個資源,只能通過配置本地庫才能加載到項目中去。
解決方法:
1、首先下載ojdbc14,下面提供的版本是:11.2.0.1.0。
鏈接:https://pan.baidu.com/s/1iB-0QhZ_imffZ-roZVdzvQ
提取碼:ewxx
2、接着打開命令提示符窗口,可通過快捷鍵Windows+R,執行cmd命令打開。
執行如下命令
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=D:\軟件\it\ojdbc14.jar
-Dfile=ojdbc14.jar文件存放的路徑
3、最后在pom.xml文件中寫入Maven坐標:
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>11.2.0.1.0</version> </dependency>
到此成功解決!