java - 公共maven库中没有oracle jdbc驱动lib?
阿神
阿神 2017-04-17 17:42:12
0
2
559

找到了一个odps jdbc driver库,但是编译时出错,有人知道原因吗?

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>
    
[ERROR] Failed to execute goal on project xx: Could not resolve dependencies for projectxxx:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc14:jar:10.2.0.4.0 in http://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]
[ERROR]
阿神
阿神

闭关修行中......

全部回覆(2)
小葫芦

因為Oracle使用的授權協議,Maven的中央庫不被允許託管其artifacts,你可以本地安裝Oracle資料庫,然後將安裝目錄中的JDBC jar包install到本地的Maven倉庫,Maven命令:#🎜 🎜#

mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar    
上面的Maven指令會把jar檔安裝到本地的Maven倉庫,DgroupId和DartifactId參數分別指定安裝時的groupId和artifactId,可以隨便指定,但肯定最好是和jar包的版本盡量一致的,避免以後混淆。

如果不想本地安裝Oracle資料庫,也可以在Oracle的官網直接下載想安裝的JDBC驅動版本(Google 搜尋「jdbc oracle」),以下是我找到的:

http://www. oracle.com/technetwork/database/features/jdbc/index-091264.html
下載之後,同樣執行上面的Maven指令。

如果JDBC驅動的版本或其他方面有問題,可以看看官方的FAQ:

http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281. html

最後,直接透過Maven來安裝Oracle JDBC驅動是可以的,但不是從Maven的中央庫(中央庫不提供,因為這是非法的)而是Oracle自己的Maven庫下載,具體步驟可以看這個頁面:

https://blogs.oracle.com/dev2dev/entry/oracle_maven_repository_instructions_for

迷茫

關於Oracle驅動版的問題,找了篇文章,寫得還比較詳細
http://elf8848.iteye.com/blog/811037

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板