2016-08-22 110 views
1

我使用的是我的應用程序的彈簧引導。 我在連接到oracle數據庫時遇到問題。我添加依賴如下。缺失oracle的神器

<dependency> 
    <groupId>com.oracle.jdbc</groupId> 
    <artifactId>ojdbc7</artifactId> 
    <version>12.1.0.2</version> 
    </dependency> 

它給了我錯誤missing artifact com.oracle.jdbc:ojdbc7:jar:12.1.0.2 我試圖通過下載jar文件放進我的根文件夾,並在我的項目的根文件夾執行以下命令來解決這個問題。

mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar 

我收到如下錯誤

Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.4.0.RELEASE/spring-boot-starter-parent-1.4.0.RELEASE.pom 
[ERROR] [ERROR] Some problems were encountered while processing the POMs: 
[FATAL] Non-resolvable parent POM for com.erp.tch:processingsystem:0 
.1.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-p 
arent:pom:1.4.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): 
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.44.215] fail 
ed: Connection refused: connect and 'parent.relativePath' points at wrong local 
POM @ line 10, column [email protected] 
[ERROR] The build could not read 1 project -> [Help 1] 
[ERROR] 
[ERROR] The project com.erp.tch:processingsystem:0.1.0:0.1.0 (C:\TIPS\wo 
rkspace\tipsredesign\pom.xml) has 1 error 
[ERROR]  Non-resolvable parent POM for com.erp.tch:processingsystem:0.1.0: Could not transfer artifact org.springframework.boot:spring-boot-start 
er-parent:pom:1.4.0.RELEASE from/to central (https://repo.maven.apache.org/maven 
2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.44.215] 
failed: Connection refused: connect and 'parent.relativePath' points at wrong lo 
cal POM @ line 10, column 13 -> [Help 2] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[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 rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin 
gException 

[ERROR] [Help 2]} 

我試圖通過添加以下,仍然沒有運氣上面解決。

<relativepath>../pom.xml</relativepath> 
+0

pom的第10行是什麼? jdbc驅動程序在本地安裝時使用'com.oracle'作爲groupId('-DgroupId = com.oracle'),但在依賴項中作爲'com.oracle.jdbc'引用(' com.oracle.jdbc') 。可能應該使用相同的groupId。爲什麼相對路徑?你在建立多個模塊嗎? – Glenn

+0

通過將groupid從 com.oracle.jdbc更改爲 com.oracle解決了該問題。謝謝你感謝你的幫助 – Developer

回答

1

JDBC驅動程序用的groupId com.oracle本地安裝:

-DgroupId=com.oracle 

但在依賴與的groupId com.oracle.jdbc引用:

<groupId>com.oracle.jdbc</groupId> 

的安裝和參考的groupId應該是一致的。

相關問題