在Maven存储库中查找Oracle JDBC驱动程序 [英] Find Oracle JDBC driver in Maven repository
问题描述
我想将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:
-
如何找到包含此工件的存储库(如果有)?
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在 pom 条目: //repo2.maven.org/maven2/com/oracle/ojdbc14/10.2.0.3.0/ojdbc14-10.2.0.3.0.pomrel =noreferrer> Maven Central repo 。只需查看它,它包含供应商首选的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后,只需将其添加到您的计算机存储库中(注意我已拉出groupId,artifactId和来自POM的版本):
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屋!