• 【Oracle/Maven】Maven导入oracle11g 自携带jdbc驱动包ojdbc6.jar到本地库


    Maven需要下载解压并添加到classpath,如果不明可以参考https://www.cnblogs.com/xiandedanteng/p/11403480.html

    然后在命令行窗口执行:

    mvn install:install-file -Dfile=D:jarsojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

    上面粗体就是我本机上ojdbc6.jar的全路径名,大家要拿下去执行请务必记得修改。

    执行效果如下:

    C:Usershorn1>mvn install:install-file -Dfile=D:jarsojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true
    [INFO] Scanning for projects...
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 467 B/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (6.4 kB at 2.4 kB/s)
    [INFO]
    [INFO] ------------------< org.apache.maven:standalone-pom >-------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] --------------------------------[ pom ]---------------------------------
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 1.5 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom (19 kB at 4.9 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 1.5 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 1.9 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (7.2 kB at 1.3 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 3.1 kB/s)
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
    Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 10.0 kB/s)
    Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 14 kB/s)
    [INFO] Installing D:jarsojdbc6.jar to C:Usershorn1.m2
    epositorycomoracleojdbc611.2.0.3ojdbc6-11.2.0.3.jar
    [INFO] Installing C:Usershorn1AppDataLocalTempmvninstall120007549088651343.pom to C:Usershorn1.m2
    epositorycomoracleojdbc611.2.0.3ojdbc6-11.2.0.3.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  48.504 s
    [INFO] Finished at: 2019-11-10T12:47:51+08:00
    [INFO] ------------------------------------------------------------------------

    看到Build Success就表示成功了。如果是Build failed也不要着急,隔天说不定就好了。昨天我的机器上就加载不进去,今天就莫名其妙好了。

    成功后本地maven库是这样的:

    之后在pom.xml中这样配就行了。

    <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
    </dependency>

     最后在Eclipse里验证一下:

    如果这一步还不成功,那么按以前的办法加载外部jar包也行。

    最后感谢以下两位小伙伴的网文:

    https://www.cnblogs.com/zhuwenjoyce/p/10923547.html

    https://blog.csdn.net/qq_38263715/article/details/80698499

    --END-- 2019年11月10日12:57:52

  • 相关阅读:
    [codevs]线段树练习5
    【Java学习笔记之十六】浅谈Java中的继承与多态
    【Java学习笔记之十五】Java中的static关键字解析
    【Java学习笔记之十四】Java中this用法小节
    【Java学习笔记之十三】初探Java面向对象的过程及代码实现
    【Java学习笔记之十二】Java8增强的工具类:Arrays的用法整理总结
    hdu2896 AC自动机
    hdu2222 AC自动机
    字符串匹配--AC自动机模板
    字符串匹配--(K)MP模板
  • 原文地址:https://www.cnblogs.com/heyang78/p/11829573.html
Copyright © 2020-2023  润新知