4

I want to download the oracle database drivers via SBT. As outlined here https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides they are password protected. In the SBT manual (http://www.scala-sbt.org/0.13/docs/Publishing.html) it is mentioned that credentials can be specified for an resolver. When applying it like:

resolvers += "oracle" at "https://maven.oracle.com"
credentials += Credentials("oracle download", "maven.oracle.com", "myEmail@gmail.com", "password")

libraryDependencies ++= Seq(
  "com.oracle.jdbc" % "ojdbc8" % "12.2.0.1"
)

I still get an

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.oracle.jdbc#ojdbc8;12.2.0.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

What is missing in the configuration?

edit

When changing the credentials to

credentials += Credentials("maven.oracle.com", "maven.oracle.com", "E-Mail", "password")

The result is

[error] Unable to find credentials for [OAM 11g @ login.oracle.com].
[warn]  module not found: com.oracle.jdbc#ojdbc8;11.2.0.4
[warn] ==== local: tried
[warn]   /Users/geoheil/.ivy2/local/com.oracle.jdbc/ojdbc8/11.2.0.4/ivys/ivy.xml
[warn] ==== oracle: tried
[warn]   https://maven.oracle.com/com/oracle/jdbc/ojdbc8/11.2.0.4/ojdbc8-11.2.0.4.pom
[info] Resolving org.apache#apache;14 ...
[error] Unable to find credentials for [OAM 11g @ login.oracle.com].
[info] Resolving jline#jline;2.12.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.oracle.jdbc#ojdbc8;11.2.0.4: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

How can I find the correct oracle realm?

Unable to find credentials for [OAM 11g @ login.oracle.com]

would suggest that OAM 11g is the realm, but that still results in the same problem. Also the https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides suggested OAM 11g does not work.

For gradle, there seems to be a workaround: https://groups.google.com/forum/#!topic/gradle-dev/G8X_41lOIlU

maven {        
        url 'https://www.oracle.com/content/secure/maven/content'
        credentials {
            username 'user'
            password 'password'
        }

but so far I could not get any option (correct realm via SSO, workaround) to work with SBT.

edit2

The best workaround so far is Find Oracle JDBC driver in Maven repository

edit3

find a reproducible example here: https://github.com/geoHeil/oracleJBCMavenSBT

Community
  • 1
  • 1
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
  • There's a problem with relying on external, public, Maven repositories (your second edit) - namely they are violating the license by making the Oracle JDBC driver available publicly, and could be required to remove it at any time via a take-down notice. We solve this using a private Nexus repo that we use for license-encumbered artifacts, our own and others. This is a perfectly legal way to serve up the Oracle JDBC drivers. – rbellamy May 14 '17 at 16:54
  • You mean edit2? yes, but I am referring to `mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \ -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true` which would not violate the license. Still I would prefer a proper setup where SBT would directly get the jars from oracle. – Georg Heiler May 14 '17 at 16:55
  • Unfortunately, I think the error you're seeing is pretty clear, and that SBT isn't your friend - specifically, the authentication host is `login.oracle.com` and your download resolver is `maven.oracle.com`. When I change the credentials to `credentials += Credentials("OAM 11g", "login.oracle.com", , "E-Mail", "password")` I know longer get an invalid login error, but the artifact is also still unresolved. – rbellamy May 15 '17 at 18:42
  • `credentials += Credentials("WebLogic Server", "login.oracle.com", "email", "password")` will result in `module not found: com.oracle.jdbc#ojdbc8;11.2.0.4`, so no longer the cant login error ... – Georg Heiler May 15 '17 at 18:50

2 Answers2

1

1) I checkout your project on github

2) I run this command for find the path of my Maven installation:

mvn -version

3) I edit the ....\apache-maven-3.5.0\conf\settings.xml file with your setting

4) I run this command:

mvn clean install

5) I have the same error

6) I valid my account on Oracle official Web site

7) I edit the ....\apache-maven-3.5.0\conf\settings.xml file with my valid login/password

8) I run this command and I have a Maven BUILD SUCCESS:

mvn clean install

You need valid your Oracle account for resolve your problem.

Note:

If you use travic-ci, run this command:

mvn clean install --settings settings.xml

In your settings.xml file:

<server>
  <id>maven.oracle.com</id>
  <username>${OTN_USERNAME}</username>
  <password>${OTN_PASSWORD}</password>
  <configuration>
    <basicAuthScope>
      <host>ANY</host>
      <port>ANY</port>
      <realm>OAM 11g</realm>
    </basicAuthScope>
    <httpConfiguration>
      <all>
        <params>
          <property>
            <name>http.protocol.allow-circular-redirects</name>
            <value>%b,true</value>
          </property>
        </params>
      </all>
    </httpConfiguration>
  </configuration>
</server> 

in travic-ci, add 2 environment variables (https://travis-ci.org/YOUTORGANIZATION/YOURREPOSITORY/settings) :

enter image description here

Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154
  • Unfortunately, I face the problems again with a freshly created account. And the formerly provided dummy account in the `settings.xml` file actually allows me to login into the oracle website - so it should be fine. – Georg Heiler Dec 19 '17 at 17:50
  • Also I always see http://www.oracle.com/webfolder/application/maven/index.html which redirects me to a) login and then b) re-accepting of the license. – Georg Heiler Dec 19 '17 at 18:11
  • 1
    you have a sample projet here: https://github.com/sgrillon14/MavenSampleOracleJdbc when this run is OK, Oracle resolve their accout (login/password) problem: https://travis-ci.org/sgrillon14/MavenSampleOracleJdbc – Stéphane GRILLON Dec 20 '17 at 20:45
0
...
resolvers += "OAM 11g" at "https://maven.oracle.com",
credentials += Credentials("OAM 11g", "login.oracle.com", "mail", "pass"),
libraryDependencies += "com.oracle.jdbc" % "ojdbc8" % "18.3.0.0" exclude("com.oracle.jdbc", "ucp"),
...

It works.

avgolubev
  • 101
  • 8