sbt从受密码保护的存储库中下载工件-oracle jdbc驱动程序作为托管依赖项 [英] sbt download artifact from password protected repository - oracle jdbc driver as managed dependency
问题描述
我想通过SBT下载oracle数据库驱动程序.如此处所述 https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides 受密码保护.在SBT手册( http://www.scala-sbt.org/0.13 /docs/Publishing.html )中提到可以为解析器指定凭据.像这样应用时:
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"
)
我仍然得到一个
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.oracle.jdbc#ojdbc8;12.2.0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
配置中缺少什么?
将凭据更改为
credentials += Credentials("maven.oracle.com", "maven.oracle.com", "E-Mail", "password")
结果是
[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] ::::::::::::::::::::::::::::::::::::::::::::::
如何找到正确的oracle领域?
How can I find the correct oracle realm?
Unable to find credentials for [OAM 11g @ login.oracle.com]
会建议OAM 11g
是领域,但这仍然会导致相同的问题.另外 https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides 建议OAM 11g
不起作用.
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.
对于gradle来说,似乎有一种解决方法: https://groups.google.com/forum/#!topic/gradle-dev/G8X_41lOIlU
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'
}
但是到目前为止,我无法获得任何选项(通过SSO正确的领域,解决方法)来使用SBT.
but so far I could not get any option (correct realm via SSO, workaround) to work with SBT.
到目前为止,最好的解决方法是在以下位置查找Oracle JDBC驱动程序Maven存储库
The best workaround so far is Find Oracle JDBC driver in Maven repository
在此处找到可复制的示例: https://github.com/geoHeil/oracleJBCMavenSBT
find a reproducible example here: https://github.com/geoHeil/oracleJBCMavenSBT
推荐答案
1)我在 github
2)我运行以下命令来查找我的Maven安装路径:
2) I run this command for find the path of my Maven installation:
mvn -version
3)我用您的设置编辑.... \ apache-maven-3.5.0 \ conf \ settings.xml文件
3) I edit the ....\apache-maven-3.5.0\conf\settings.xml file with your setting
4)我运行以下命令:
mvn clean install
5)我有相同的错误
6):我的帐户在 Oracle官方网站上有效/a>
7)我使用有效的登录名/密码编辑.... \ apache-maven-3.5.0 \ conf \ settings.xml文件
7) I edit the ....\apache-maven-3.5.0\conf\settings.xml file with my valid login/password
8)我运行了此命令,并且有 Maven BUILD SUCCESS :
8) I run this command and I have a Maven BUILD SUCCESS:
mvn clean install
您需要有效的Oracle帐户才能解决问题.
注意:
如果使用travic-ci,请运行以下命令:
If you use travic-ci, run this command:
mvn clean install --settings settings.xml
在您的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>
在travic-ci中,添加2个环境变量( https://travis-ci.org /YOUTORGANIZATION/您的存储库/设置):
in travic-ci, add 2 environment variables (https://travis-ci.org/YOUTORGANIZATION/YOURREPOSITORY/settings) :
这篇关于sbt从受密码保护的存储库中下载工件-oracle jdbc驱动程序作为托管依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!