【问题标题】:Error trying to import oracle jdbc7 driver with Maven尝试使用 Maven 导入 o​​racle jdbc7 驱动程序时出错
【发布时间】:2016-09-02 20:58:24
【问题描述】:

我无法使用 maven 导入 jdbc7 oracle 驱动程序,我按照教程 Oracle Blogs 所做的所有操作,但收到以下错误:

无法解析项目的依赖关系 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 协议=http/1.1} (recycle count=0): \n not found: size=0 content=... ->

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

在提到的教程中,我不明白应该继承哪些信息......

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

也许这是错误来源。

这是我的 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...

<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 的同一路径下创建的

感谢您的帮助。

【问题讨论】:

标签: java oracle maven jdbc


【解决方案1】:

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

  1. Oracle Web Site下载Jar
  2. 将 Jar 包含到 Maven 本地存储库中。向Mkyong Web Site学习
  3. 使用依赖项更新 Pom

如果有人有其他想法,我会很高兴知道。

【讨论】:

    猜你喜欢
    • 2019-01-23
    • 2017-06-06
    • 1970-01-01
    • 2019-04-22
    • 2013-10-06
    • 1970-01-01
    • 2014-08-21
    • 2012-06-20
    • 1970-01-01
    相关资源
    最近更新 更多