Search code examples
javaoracle-databasemavengradleojdbc

Oracle ojdbc8 12.2.0.1 bad pom encoding


Trying to download from Oracle Maven Repo in a gradle project, it fails because seems to be a problem with pom file encoding.

If you create a build.gradle file like this with your Oracle credentials:

plugins {
  id 'java'
  id 'distribution'
}    
repositories {
  maven {
    url 'https://www.oracle.com/content/secure/maven/content'
    credentials {
      username '[email protected]'
      password 'mypwd'
    }
  }
}

dependencies {
  compile 'com.oracle.jdbc:ojdbc8:12.2.0.1'
}

distributions {
    main {
        contents {
            from configurations.compile
        }
    }
}

And execute this:

$> gradle distZip

Fails:

Could not resolve com.oracle.jdbc:orai18n:12.2.0.1. Required by: project : > com.oracle.jdbc:ojdbc8:12.2.0.1 Could not resolve com.oracle.jdbc:orai18n:12.2.0.1. Could not parse POM https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/orai18n/12.2.0.1/orai18n-12.2.0.1.pom Byte no válido 1 de la secuencia UTF-8 de 1 bytes

I've cut the output, but fails with the rest of poms referenced by the first.

If you download the file via browser, it seems that file has latin-1 encoded characters inside (instead of utf-8 as indicate in xml first line).

It seems it happened before: https://community.oracle.com/thread/4031349

Is it possible circunvent this?


Solution

  • It seems only fails with optional dependencies (ojdbc8 and ucp download fine). To avoid problems, and if you don't need those dependencies, exclude them this way in build.gradle:

    compile ('com.oracle.jdbc:ojdbc8:12.2.0.1') {
        exclude group: 'com.oracle.jdbc'
    }