尝试使用Maven导入oracle jdbc7驱动程序时出错 [英] Error trying to import oracle jdbc7 driver with Maven

查看:191
本文介绍了尝试使用Maven导入oracle jdbc7驱动程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用Maven导入jdbc7 oracle驱动程序,我做了所有与教程 Oracle相似的操作博客,但我收到以下错误消息:

I cannot import the jdbc7 oracle driver with maven, I did everything like in the tutorial Oracle Blogs but I received the follow error:

无法解决项目的依赖关系 com.jp:database_connection_app:jar:0.0.1:收集失败 com.oracle.jdbc:ojdbc7:jar:12.1.0.2的依赖项:读取失败 com.oracle.jdbc:ojdbc7:jar:12.1.0.2的工件描述符:可以 不从/传输工件com.oracle.jdbc:ojdbc7:pom:12.1.0.2 maven.oracle.com( https://maven.oracle.com ):流意外结束 在Connection {maven.oracle.com:443,proxy = HTTP @/myProxyIP:myPort hostAddress = hostAddressIP cipherSuite = none protocol = http/1.1} (回收计数= 0):\ n未找到:大小= 0内容= ...->

Could not resolve dependencies for project com.jp:database_connection_app:jar:0.0.1: Failed to collect dependencies at com.oracle.jdbc:ojdbc7:jar:12.1.0.2: Failed to read artifact descriptor for com.oracle.jdbc:ojdbc7:jar:12.1.0.2: Could not transfer artifact com.oracle.jdbc:ojdbc7: pom:12.1.0.2 from/to maven.oracle.com (https://maven.oracle.com): unexpected end of stream on Connection{maven.oracle.com:443, proxy=HTTP @ /myProxyIP:myPort hostAddress=hostAddressIP cipherSuite=none protocol=http/1.1} (recycle count=0): \n not found: size=0 content=... ->

对我来说,一种特殊情况是,我位于代理后面,但是我已经配置了settings.xml文件,并且maven可以下载除JDBC之外的所有依赖项.

A special case to me is that I'm in behind a proxy but I already configure the settings.xml file and maven can download all the dependencies except the JDBC.

在所提到的教程中,我不知道哪些信息会更有趣...

In the tutorial mentioned, I didn't understand which information shall be hier...

<basicAuthScope>
    <host>ANY </host>
    <port>ANY </port>
    <realm>OAM 11g </realm>
</basicAuthScope>

也许这是错误源.

这是我的settings.xml ...

Here is my settings.xml...

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<pluginGroups/>
<servers> 
    <server> 
      <id>maven.oracle.com</id> 
      <username>myUsername</username> 
      <password>My_Encripted_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> 
</servers>
<mirrors>
    <mirror>
      <id>UK</id>
      <name>UK Central</name>
      <url>http://uk.maven.org/maven2</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>
<proxies>
    <proxy>
      <id>default</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>myProxy</host>
      <port>myPort</port>
      <username>myUsername</username>
      <password>myPassword</password>
      <nonProxyHosts>*.google.com</nonProxyHosts>
    </proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings> 

这是我的POM ...

Here is my POM...

<dependencies>
        <dependency>
          <groupId>com.oracle.jdbc</groupId>
          <artifactId>ojdbc7</artifactId>
          <version>12.1.0.2</version>
        </dependency>
        <dependency>
          <groupId>com.oracle.jdbc</groupId>
          <artifactId>ucp</artifactId>
          <version>12.1.0.2</version>
        </dependency>
    </dependencies> 

    <repositories>
        <repository>
            <id>maven.oracle.com</id>
            <name>oracle-maven-repo</name>
            <url>https://maven.oracle.com</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
        </repository>
     </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>maven.oracle.com</id>
            <name>oracle-maven-repo</name>
            <url>https://maven.oracle.com</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>

settings-security.xml是在settings.xml的相同路径下创建的

The settings-security.xml is created under the same path of the settings.xml

感谢您的帮助.

推荐答案

我无法像我想要的那样导入库,然后我不得不寻找另一种解决方案:

I couldn't import the library like I wanted, then I had to search for another solution:

  1. Oracle Web下载Jar网站
  2. 包括Jar以Maven本地存储库.从 Mkyong网站
  3. 使用依赖项更新Pom
  1. Download the Jar from Oracle Web Site
  2. Include Jar to maven local repository. Learned from Mkyong Web Site
  3. Update Pom with the dependency

如果有人有其他想法,我会很高兴知道这一点.

If someone have another idea, I will be happy to know that.

这篇关于尝试使用Maven导入oracle jdbc7驱动程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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