我正在尝试在pom.xml中添加对ojdbc14的依赖关系。
我遵循的在maven本地存储库中添加ojdbc14.jar的步骤:

  • 创建一个新项目
  • 移至命令提示符中pom.xml文件所在的特定文件夹。
  • 执行命令mvn clean
  • 执行命令:

    mvn install:安装文件-Dfile = ojdbc14.jar -DgroupId = com.oracle -DartifactId = oracle -Dversion = 10.2.0.1.0 -Dpackaging = jar -DgeneratePom = true

  • 在此之后,我得到了构建成功消息

    我已经在Eclipse> Maven Repositories中更新了全局和本地存储库
    C:\> mvn install:install-file -Dfile="C:\Users\Dhia\Desktop\Nouveau dossier\ojdb
    c14.jar" -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackag
    ing=jar
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
    ---
    [INFO] Installing C:\Users\Dhia\Desktop\Nouveau dossier\ojdbc14.jar to C:\Users\
    Dhia\.m2\repository\com\oracle\ojdbc14\10.2.0.1.0\ojdbc14-10.2.0.1.0.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.460s
    [INFO] Finished at: Sat Feb 28 22:44:13 CET 2015
    [INFO] Final Memory: 4M/15M
    [INFO] ------------------------------------------------------------------------
    C:\>
    

    我的本地仓库是C:\Users\Dhia\Desktop\eclipse jee
    并且在eclipse oracle存储库中打开.com时未出现

    在添加时

    甲骨文
    ojdbc14
    10.2.0.1.0


    我的pom.txt

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>b</groupId>
      <artifactId>b</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>war</packaging>
      <name>b</name>
    
        <repositories>
            <repository>
                    <id>prime-repo</id>
                    <name>PrimeFaces Maven Repository</name>
                    <url>http://repository.primefaces.org</url>
            </repository>
     <!--
     <repository>
        <id>central</id>
        <url>http://repo1.maven.org/maven2/</url>
      </repository>
       -->
      </repositories>
    
      <dependencies>
    
    
            <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                    <version>4.1.8.Final</version>
            </dependency>
            <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                    <version>4.2.0.Final</version>
            </dependency>
                <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                    <groupId>org.springframework.webflow</groupId>
                    <artifactId>spring-webflow</artifactId>
                    <version>2.3.1.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>org.springframework.webflow</groupId>
                    <artifactId>spring-faces</artifactId>
                    <version>2.3.1.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-orm</artifactId>
                    <version>3.1.1.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc14</artifactId>
                    <version>10.2.0.1.0</version>
            </dependency>
            <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.16</version>
            </dependency>
            <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-impl</artifactId>
                    <version>2.1.10</version>
            </dependency>
            <dependency>
                    <groupId>com.sun.facelets</groupId>
                    <artifactId>jsf-facelets</artifactId>
                    <version>1.1.14</version>
            </dependency>
            <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-api</artifactId>
                    <version>2.1.10</version>
            </dependency>
            <dependency>
                    <groupId>commons-dbcp</groupId>
                    <artifactId>commons-dbcp</artifactId>
                    <version>20030825.184428</version>
            </dependency>
            <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>1.6.4</version>
            </dependency>
            <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>3.0.1</version>
                    <scope>provided</scope>
            </dependency>
            <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                    <version>3.0.5.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                    <version>1.3.02</version>
            </dependency>
            <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-web</artifactId>
                    <version>3.1.3.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-config</artifactId>
                    <version>3.1.3.RELEASE</version>
            </dependency>
            <dependency>
                    <groupId>org.primefaces</groupId>
                    <artifactId>primefaces</artifactId>
                    <version>3.4</version>
            </dependency>
            <dependency>
                    <groupId>cglib</groupId>
                    <artifactId>cglib</artifactId>
                    <version>2.2.2</version>
                    <scope>runtime</scope>
            </dependency>
            <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>4.1.8.Final</version>
            </dependency>
      </dependencies>
    
    </project>


    我的pom.xml文件中有错误:缺少 Artifact com.oracle:ojdbc14:jar:10.2.0.1.0,并且在本地存储库中看不到ojdbc14.jar文件。我遵循的步骤有什么问题吗?请帮帮我。

    谢谢

    最佳答案

    这不能直接安装,因为Oracle已经签了一些许可证和协议(protocol)。因此,我们必须手动下载它并将其安装到项目中。 Use this link选择所需的版本并下载ojdbc14.jar文件。您必须具有一个Oracle帐户才能下载它。

    然后打开命令提示符。转到文件下载位置。然后输入以下代码。

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

    使用所需的版本填写x。然后右键单击您的项目>“Maven”>“更新项目”。

    这样可以解决问题。

    10-07 16:16