I want to download the odjbc7.jar
at compile time so that I can run all of my tests in Travis CI. I've added a setting in my gradle.properties
so that it'll only download the jar for building.
Users of my tool will provide the driver themselves so as not to go against Oracles license agreements.
All of the solutions I have found online answer the question by saying to point to a local jar which won't work for my CI build or for others wanting to build the application (I can't distribute the ojdbc jar as part of my repository).
Below is the relevant sections of my build.gradle
,
I have the properties mavenOracleUsername and mavenOraclePassword in my gradle.properties
(I have checked these are correct on the Oracle single-sign on site) :
def oracleUsername = hasProperty('mavenOracleUsername') ? mavenOracleUsername : System.getenv('mavenOracleUsername')
def oraclePassword = hasProperty('mavenOraclePassword') ? mavenOraclePassword : System.getenv('mavenOraclePassword')
repositories {
jcenter()
maven {
url "https://www.oracle.com/content/secure/maven/content"
// url "https://maven.oracle.com"
credentials {
username "${oracleUsername}"
password "${oraclePassword}"
}
}
}
...
dependencies {
compile group: 'com.oracle.jdbc', name: 'ojdbc7', version: '12.1.0.2'
}
When I run my build I get the following error:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not resolve com.oracle.jdbc:ojdbc7:12.1.0.2.
Required by:
project :
> Could not resolve com.oracle.jdbc:ojdbc7:12.1.0.2.
> Could not get resource 'https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ojdbc7/12.1.0.2/ojdbc7-12.1.0.2.pom'.
> Could not GET 'https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ojdbc7/12.1.0.2/ojdbc7-12.1.0.2.pom'. Received status code 403 from server: Forbidden
If I change the credentials I get a 401 response and if I change the version of the jar I get a not found in repository error.