2012-10-06 69 views
0

可能重複:
Maven Cannot Resolve Local DependencyMaven的依賴錯誤

我使用maven 3 Eclispe的JUNO。

創建maven項目後,我使用eclipse插件 生成eclipse文件並將項目導入到eclipse中。

我已經添加了一個我創建的maven項目的jar。

該jar文件被安裝到項目本地存儲庫。 這是在項目基礎目錄中稱爲repo的文件。

安裝:install-file命令用於將jar添加到repo文件, 然後將jar依賴項添加到項目的Pom文件中。

在eclipse IDE中,我可以導入jar文件作爲 任何其他庫導入。

但是,當我運行mvn編譯命令, 我得到一個依賴性錯誤,maven說它 找不到jar文件。我提供了下面的代碼。

他是POM回購配置

<repository> 
    <id>repo</id> 
    <releases> 
     <enabled>true</enabled> 
     <checksumPolicy>ignore</checksumPolicy> 
    </releases> 
    <snapshots> 
     <enabled>false</enabled> 
    </snapshots> 
    <url>file://${project.basedir}/repo</url> 
</repository> 

這是依賴構

<dependency> 
     <groupId>Com.RubineEngine.GesturePoints</groupId> 
     <artifactId>Com-RubineEngine-GesturePoints</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

當編譯被拼命地跑與U和X交換機,下面的誤差被呈現

[DEBUG] ======================================================================= 
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for file://C:\U 
sers\FAISAL\Desktop\disaster\com-initialtheta-theta/repo 
Downloading: file://C:\Users\FAISAL\Desktop\disaster\com-initialtheta-theta/repo 
/Com/RubineEngine/GesturePoints/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/mave 
n-metadata.xml 
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi 
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat 
us.properties 
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for repo 
.typesafe.com/typesafe/releases/ 
Downloading: repo.typesafe.com/typesafe/… 
Points/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/maven-metadata.xml 
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi 
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat 
us.properties 
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine- 
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in typesafe (repo.typesafe. 
com/typesafe/releases/) 
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine- 
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in lib (file://C:\Users\FAISAL\Des 
ktop\disaster\com-initialtheta-theta/repo) 
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin 
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th 
is session. 
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP 
oints:1.0-SNAPSHOT/maven-metadata.xml in repo.typesafe.com/typesafe/… 
ses/ was cached in the local repository, resolution will not be reattempted unti 
l the update interval of typesafe has elapsed or updates are forced 
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin 
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th 
is session. 
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP 
oints:1.0-SNAPSHOT/maven-metadata.xml in file://C:\Users\FAISAL\Desktop\disaster 
\com-initialtheta-theta/repo was cached in the local repository, resolution will 
not be reattempted until the update interval of lib has elapsed or updates are 
forced 

任何一個人都可以幫助我,因爲我遲到了

+0

我有一個愚蠢的問題,我必須問:你之前在工作區中成功構建過任何maven工件嗎? –

+0

您在依賴性語句中使用快照版本似乎很奇怪,但您試圖從中獲取此版本的存儲庫已禁用快照。我無法找到關於如何設置的具體說明,但我敢打賭這是不正確的。一個可能有用的資源是http://maven.apache.org/ref/3.0。4 /行家模型/ maven.html。 –

回答

0

一些事情,試圖/確認:

  • 有時機器可以訪問互聯網。不要只是說它。通過ping遠程的東西來確認它。 Maven不喜歡不能訪問版本庫
  • 在pom編輯器中,是否顯示任何錯誤消息?你可以刪除依賴項並使用添加依賴項對話框添加它嗎?
  • 嘗試將存儲庫放在Eclipse工作區之外。從理論上講,它應該工作在什麼地方,但是這是一個奇怪的地方,有一個倉庫,而且maven不喜歡「奇怪」。
  • 轉到存儲庫根目錄並確認文件夾名稱與組ID,工件ID和依賴版本完全匹配。