How to use Oracle JDBC driver in Gradle project

前端 未结 7 1252
醉话见心
醉话见心 2020-12-15 19:09

I\'m new with Gradle projects and I have one question. I\'ve searched in Internet but I couldn\'t find what I need or maybe I couldn\'t know how to search it. First I\'m goi

7条回答
  •  猫巷女王i
    2020-12-15 19:39

    You can try reusing your local Maven repository for Gradle:

    • Download ojdbc7.jar from Oracle site
    • Install the jar into your local Maven repository:

      mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
      
    • Check that you have the jar installed into your ~/.m2/ local Maven repository

    • Enable your local Maven repository in your build.gradle file:

      repositories {  
          mavenCentral()  
          mavenLocal()  
      }  
      
      dependencies {  
          compile ("com.oracle:ojdbc7:12.1.0.1")  
      }  
      
    • Now you should have the jar enabled for compilation in your project

提交回复
热议问题