Missing artifact com.oracle:ojdbc6:jar:11.2.0.1.0问题解决 ojdbc包pom.xml出错

刚学习spring boot 因公司使用的是oracle ,Oracle的ojdbc.jar是收费的,所以maven的中央仓库中没有这个资源,只能通过配置本地库才能加载到项目中去。

先配置本地的maven仓库地址:

2.找到oracle jar包.

我电脑里的jar包放在:

D:\app\admin\product\11.2.0\dbhome_1\jdbc\lib

打开jar包在的目录:然后按住Shift +右键 打开命令行,执行以下命令,将ojdbc6.jar包添加到maven,也就是运行下面的语句,注意:不是在C盘下运行,是在该目录下执行下面的语句。

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc6.jar

命令行显示如下:

D:\app\admin\product\11.2.0\dbhome_1\jdbc\lib>mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc6.jar                                                                          [INFO] Scanning for projects...                                                 Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom                     Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 12 kB/s)  Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom                                 Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom (13 kB at 85 kB/s)               Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar                     Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar (25 kB at 138 kB/s)  Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom                 Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (6.4 kB at 37 kB/s)                                                                              Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar                 Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar (27 kB at 125 kB/s)                                                                              [INFO]                                                                          [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1                                   [INFO] ------------------------------------------------------------------------ [INFO]                                                                          [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---                                                                             Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom                                  Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 15 kB/s)               Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom                                                  Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom (19 kB at 118 kB/s)                               Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom                                    Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 5.4 kB/s)                Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom                        Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 32 kB/s)     Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom                                              Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (7.2 kB at 50 kB/s)                           Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom                                                                              Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 46 kB/s)                                                           Downloading: http://maven.aliyun.com/nexus/content/groups/public/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar                                Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar                                    Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar                                  Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 66 kB/s)                  Downloaded: http://maven.aliyun.com/nexus/content/groups/public/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar (38 kB at 189 kB/s)             Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 462 kB/s)              [INFO] Installing D:\app\admin\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar to E:\eclipse\spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64\sts-bundle\sts-3.9.0.RELEASE\repository\com\oracle\ojdbc6\11.2.0.1.0\ojdbc6-11.2.0.1.0.jar         [INFO] Installing C:\Users\admin\AppData\Local\Temp\mvninstall887833532666323655.pom to E:\eclipse\spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64\sts-bundle\sts-3.9.0.RELEASE\repository\com\oracle\ojdbc6\11.2.0.1.0\ojdbc6-11.2.0.1.0.pom                                                                               [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS                                                            [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.636 s                                                      [INFO] Finished at: 2018-01-02T21:31:04+08:00                                   [INFO] Final Memory: 10M/362M                                                   [INFO] ------------------------------------------------------------------------

最后找到项目的pom.xml引入如下代码,右击项目名称,找到maven,找到update project更新下就ok了

<!-- oracle数据库驱动 -->
<dependency>
   <groupId>com.oracle</groupId>
   <artifactId>ojdbc6</artifactId>
   <version>11.2.0.1.0</version>
</dependency>

 

 

 

此方法学习自:http://blog.csdn.net/viktoria/article/details/77503266

相关文章
相关标签/搜索