英文:
Gradle : Could not download ojdbc7.jar
问题
我正在尝试通过Intellij运行Gradle项目。我使用的是Gradle 6.6.1和Java 11。然而,我遇到了以下错误。
无法下载ojdbc7.jar(com.oracle:ojdbc7:1.0)
有人可以帮忙吗?非常感谢您的时间和帮助。
英文:
I'm trying to run the Gradle project through Intellij. I'm using Gradle 6.6.1 and Java 11 However, I'm getting below error.
Could not download ojdbc7.jar (com.oracle:ojdbc7:1.0)
Can someone please help? Thank you for your time and help.
答案1
得分: 3
虽然 Oracle 有自己的 Maven 存储库,正如另一个回答中所提到的,但他们已经开始使用 Maven Central 作为主要存储库来分发客户端库。它们可以在组名 com.oracle.database.jdbc 下找到。
如果您使用 Java 11,就不需要支持 Java 7 的 OJDBC 变体。相反,您应该使用 ojbdc10,它支持 Java 10 和 11。在 这里 了解有关不同驱动程序变体的更多信息。
在撰写本文时,ojdbc10 的最新版本是 19.7.0.0。它已被 认证可与 RDBMS 版本从 11.2 到 19c 一起使用。因此,将所有内容放在一起,可以在 Gradle 中使用以下依赖声明:
repositories {
mavenCentral() // 或者 jcenter()
}
dependencies {
runtimeOnly 'com.oracle.database.jdbc:ojdbc10:19.7.0.0' // 或 'implementation'
}
英文:
While Oracle do have a Maven repository of their own, as noted in another answer, they have started using Maven Central as the primary repository for distributing client libraries. They are available under the group name com.oracle.database.jdbc.
If you use Java 11, you don't need the variant of OJDBC for supporting Java 7. Instead, you should use ojbdc10, which supports both Java 10 and 11. Read more about the different variants of the drivers here.
The latest version of ojdbc10 at the time of this writing is 19.7.0.0. It is certified to work with RDBMS from 11.2 to 19c. So to put it all together, use this dependency declaration in Gradle:
repositories {
mavenCentral() // or jcenter()
}
dependencies {
runtimeOnly 'com.oracle.database.jdbc:ojdbc10:19.7.0.0' // Or 'implementation'
}
答案2
得分: 0
这个依赖项可在 Oracle Maven 存储库中获得,需要登录。需要用户名和密码,可以通过在 Oracle 进行注册来获得。添加的存储库应该具有以下形式:
repositories {
//其他存储库...
maven {
url "https://www.oracle.com/content/secure/maven/content"
name "maven.oracle.com"
credentials {
username 'email@mail.com'
password 'your password'
}
}
}
这些信息来自于这篇文章。
英文:
This dependency is available in the oracle maven repository which requires to login. A username and a password are needed that can be acquired by registration to oracle. The repository added should be of the following form:
repositories{
//Other repositories...
maven {
url "https://www.oracle.com/content/secure/maven/content"
name "maven.oracle.com"
credentials {
username 'email@mail.com'
password 'your password'
}
}
}
This information was extracted from this article.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论