在 Maven 存储库中查找 Oracle JDBC 驱动程序 [英] Find Oracle JDBC driver in Maven repository

查看:32
本文介绍了在 Maven 存储库中查找 Oracle JDBC 驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 oracle jdbc 驱动程序作为依赖项(运行时范围)- ojdbc14 添加到我的项目中.在 MVNrepository 站点中,放置在 POM 中的依赖项是:

I want to add the oracle jdbc driver to my project as dependency (runtime scope) - ojdbc14. In MVNrepository site the dependency to put in the POM is:

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.3.0</version>
</dependency>

当然这不起作用,因为它不在 maven 使用的中央存储库中.2个问题:

of course this does't work as it is not in the central repository used by maven. 2 questions:

  1. 如何找到包含此工件的存储库(如果有)?

  1. How do I find a repository (if any) that contains this artifact?

如何添加它以便 Maven 使用它?

How do I add it so that Maven will use it?

推荐答案

我如何找到包含此工件的存储库(如果有)?

不幸的是,由于是二进制许可证,因此没有包含 Oracle Driver JAR 的公共存储库.这发生在许多依赖项中,但这不是 Maven 的错.如果您碰巧找到包含 JAR 的公共存储库,您可以确定这是非法的.

Unfortunately due the binary license there is no public repository with the Oracle Driver JAR. This happens with many dependencies but is not Maven's fault. If you happen to find a public repository containing the JAR you can be sure that is illegal.

如何添加它以便 Maven 使用它?

某些由于许可原因无法添加的 JAR 在 Maven 中央仓库.只需检查一下,它包含供应商的首选 Maven 信息:

Some JARs that can't be added due to license reasons have a pom entry in the Maven Central repo. Just check it out, it contains the vendor's preferred Maven info:

<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>

...以及下载文件的 URL,在这种情况下是http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html.

...and the URL to download the file which in this case is http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html.

下载 JAR 后,只需将其添加到您的计算机存储库中(注意我从 POM 中提取了 groupId、artifactId 和 version):

Once you've downloaded the JAR just add it to your computer repository with (note I pulled the groupId, artifactId and version from the POM):

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 
     -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true

生成 POM 的最后一个参数将使您免于 pom.xml 警告

如果您的团队有本地 Maven 存储库 本指南 可能有助于在那里上传 JAR.

If your team has a local Maven repository this guide might be helpful to upload the JAR there.

这篇关于在 Maven 存储库中查找 Oracle JDBC 驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆