首页 > 解决方案 > 缺少工件 oracle:ojdbc6:jar:11.2.0.3

问题描述

我正面临“缺少工件 oracle:ojdbc6:jar:11.2.0.3”的问题。我浏览了很多博客,但都没有成功。

我也尝试过使用 ojdbc14、ojdbc7,但无法继续进行。

POM 文件依赖:

<!-- https://mvnrepository.com/artifact/oracle/ojdbc6 -->
        <dependency>
            <groupId>oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>

MAVEN 错误: Maven 错误

我尝试将 oracle jar 文件安装到本地存储库,但收到以下错误。

mvn install:install-file -Dfile={C:\Users\Riya.m2\repository\com\oracle\ojdbc6\11.2.0.3} -DgroupId=oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar - DlocalRepositoryPath=C:\Users\Riya.m2\repository

C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB>mvn install:install-file -Dfile={C:\Users\Riya\.m2\repository\com\oracle\ojdbc6\11.2.0.3} -DgroupId=oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DloaclRepositoryPath=C:\Users\Riya\.m2\repository
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.spring:SpringWriteToDB >---------------------
[INFO] Building SpringBatchDemo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ SpringWriteToDB ---
**[ERROR] The specified file 'C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB\{C:\Users\Riya\.m2\repository\com\oracle\ojdbc6\11.2.0.3}' not exists
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project SpringWriteToDB: The specified file 'C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB\{C:\Users\Riya\.m2\repository\com\oracle\ojdbc6\11.2.0.3}' not exists -> [Help 1]**
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我按照以下链接中的步骤操作,但无法继续。 缺少工件 com.oracle:ojdbc6:jar:11.2.0.3,

我在我的个人笔记本电脑上使用,与setting.xml文件有关吗?我面临公司笔记本电脑的问题,因为它具有本地存储库设置。

标签: springmavenjdbc-odbc

解决方案


输出很清楚:

指定的文件“C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB{C:\Users\Riya.m2\repository\com\oracle\ojdbc6\11.2.0.3}”不存在

我假设你从这个目录运行命令

'C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB\'. 

只需将您的 jar 放入该目录并运行:

mvn install:install-file -Dfile=myfile.jar -DgroupId=oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DlocalRepositoryPath=C:\Users\Riya.m2\repository

Maven 将在此处期望 jar 文件 'C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB\myfile.jar' 它将安装您的工件。

重要提示: 使用文件的完整路径更安全。上一个命令将使用文件的相对路径。

mvn install:install-file -Dfile=C:\Preeti_WORK\WorkSpace\SPRING-BATCH\SpringWriteToDB\ojdbc6.jar -DgroupId=oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DlocalRepositoryPath=C:\Users\Riya.m2\repository

推荐阅读