因爲授權問題,maven是無法直接通過依賴下載oracle jar包的,所以需要手動導入jar包。
- 下載相關ojdbc.jar相應版本,官網直接下載
- 打開ojdbc.jar 查看對應版本號META-INF ,如:Specification-Version: Oracle JDBC Driver version - "10.2.0.3.0"
- 執行mvn命令 已經下載安裝成功了。
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc14.jar --X help:effective-pom
PS:安裝過程中會遇到幾種報錯:
#1.Goal requires a project to execute but there is no POM in this directory...., Goal requires a project to execute but there is no POM in this directory (C:\Users\hxl). Please verify you invoked Maven from the correct directory.
解決:這是有些jar包依賴需要配pom文件,直接按照你的jar 包版本,寫一個pom文件
#2.No plugin found for prefix 'install' in the current project and in the p lugin groups [org.apache.maven.plugins, org.codehaus.mojo]
解決:這種是由於有些plugins下載不到報錯了,直接更換阿里雲mvn鏡像鏈接即可。
另外安裝過程一定加上mvn -X命令可以顯示更多報錯信息出來