How to add ojdbc7 to Java web app by Gradle?

Gradle currently can’t handle the redirects needed by the realm-based
SSO mechanism used by Oracle’s maven repo.

A workaround is to use this URL instead

url "https://www.oracle.com/content/secure/maven/content"

In addition, you need to supply credentials for authentication.

Here’s a minimal example:

plugins {
  id 'java'
}

repositories {
    jcenter()

    maven {

       url "https://www.oracle.com/content/secure/maven/content"

       credentials {
         username="<Oracle Account email address>"
         password = '<Oracle Account password>'
       }
    }
}

dependencies {
    compile 'com.oracle.jdbc:ojdbc7:12.1.0.2'
}

I have a github repo with full example including a way of encrypting the password using maven’s settings.xml and settings-security.xml: example-gradle-oracle

I am adding = after username and password as mentioned in Gradle AuthenticationSupported.java file

Leave a Comment