java - 如何将Oracle ons.jar 添加到maven 项目中

标签 java oracle maven oracle10g

全部,

我们敬爱的 DBA 提出了一个请求,要求我们为我们的 Oracle JDBC 连接添加 hibernate ons 配置。现在,为了让它起作用,我们需要 Oracle provided ons.jar在类路径中。

我们当前的 oracle jdbc 库节是

<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc14</artifactId>
  <version>10.2.0.2.0</version>
  <scope>compile</scope>
</dependency>

我试着环顾四周是否可以将 ons.jar 添加到 maven 依赖列表,但不能。任何人都可以提供有关如何添加此内容的任何意见吗?

我浏览了 ibiblio maven 存储库,它只有 ojdbc14 ons.jar 没有任何内容。

干杯!

最佳答案

由于 ons.jar 在您的仓库中不可用,您必须手动下载它,然后将其添加到您的仓库中。

您可以将它添加到您的本地存储库:

mvn install:install-file -DgroupId=com.oracle -DartifactId=ons -Dversion=10.2.0.2.0 -Dfile=/path/to/file -Dpackaging=jar -DgeneratePom=true

如果你有一个远程仓库,你可以用下面的命令部署到它:

mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ons -Dversion=10.2.0.2.0 -DrepositoryId=<id-to-map-on-server-section-of-settings.xml> -Durl=<url-of-the-repository-to-deploy>

更多信息:Maven - Guide to deploying 3rd party JARs to remote repository

在你的 repo 中安装文件后,你可以将依赖项添加到项目的 pom.xml 中:

<dependency>
 <groupId>com.oracle</groupId>
 <artifactId>ons</artifactId>
 <version>10.2.0.2.0</version>
 <scope>compile</scope>
</dependency>

关于java - 如何将Oracle ons.jar 添加到maven 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6052232/

相关文章:

java - Android:Spinner onItemSelect 膨胀另一个 Spinner

具有多个对象/锁的 Java 同步

git - 尝试运行gradle build时无法读取文件/usr/local/git/etc/gitconfig

java - 是否可以在 Linux 下构建 JNI .dll?

java - 使用 MongoClientOptions 设置 MongoDB Url

java - hibernate JPA 2.1 : OUT REF CURSOR in position other than first?

sql - Oracle - 在禁用状态下添加外部约束?

oracle - 如何选择和优化oracle索引?

java - 如何获取 Maven 项目 list 中 Implementation-Version 字段中的 git SHA1 值?

java - 为什么我的 JTable 不允许我插入 ImageIcon?