2013-06-24 23 views
0

在建設我的工作區,我的Java 6 Maven項目標有一個錯誤(Maven的問題):Eclipse中尋找錯誤的神火依賴

Could not calculate build plan: The repository system is offline but the artifact org.apache.maven.surefire:surefire:pom:2.7.1 is not available in the local repository. 

什麼令我奇怪的是,它是尋找組織.apache.maven.surefire:surefire,而真正的依賴是org.apache.maven.surefire:maven-surefire-plugin。

我的有效POM是顯示:

<plugin> 
<artifactId>maven-surefire-plugin</artifactId> 
<version>2.7.1</version> 
<executions> 

我使用Eclipse靛藍與m2eclipse插件。它在運行任何Maven目標時都能正確編譯。我試圖清理項目,重新導入它,清除.metadata文件。 這種行爲從何而來?謝謝

回答

0

提到的依賴項是maven-surefire-plugin的父項目,通常不應僅通過maven-surefire-plugin本身直接給出。

此外What strikes me as odd is that it is searching for org.apache.maven.surefire:surefire while the true dependency is org.apache.maven.surefire:maven-surefire-plugin.這是完全錯誤的,導致正確的groupId和artifactId的爲maven-surefire-plugin是:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.7.2</version> 
    ... 
</plugin> 

它可能是有可能在訪問行家中心問題。除了上面的內容,你應該更新maven-surefire-plugin,因爲當前的最新版本是2.15。