2013-03-14 62 views
13

我已將Maven與Eclipse集成並嘗試創建maven項目。每次我嘗試創建項目時,它的POM.xml都顯示錯誤。插件org.apache.maven.plugins:maven-resources-plugin:2.5或其某個依賴關係無法解析:UnresolvedAddressException

Multiple annotations found at this line: - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile) - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from htt:///repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (htt:///repo.maven.apache.org/maven2): null to htt://
repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom

如果我嘗試運行maven-install或任何maven run選項。我得到這個錯誤

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See htt://www.slf4j.org/codes.html#StaticLoggerBinder for further details. [INFO] Scanning for projects... [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building CQ5 MyApp UI 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.289s [INFO] Finished at: Thu Mar 14 14:39:09 IST 2013 [INFO] Final Memory: 1M/15M [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (htt://repo.maven.apache.org/maven2): null to htt://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom: UnresolvedAddressException -> [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/PluginResolutionException

我該怎麼辦?

+0

你能發佈你的pom.xml嗎? – 2013-03-15 10:37:05

回答

2

聽起來像你可能需要在你的pom文件中添加sl4j依賴項。在這裏看到:Failed to load class "org.slf4j.impl.StaticLoggerBinder"

下面是從依賴取景器中CQ5.5的depenedency:

<dependency> 
    <groupId>org.apache.sling</groupId> 
    <artifactId>org.apache.sling.commons.log</artifactId> 
    <version>2.1.3-R1232904</version> 
    <scope>provided</scope> 
</dependency> 

希望幫助和好運。

18
  1. 如果您正在使用像我這樣的Windows,只需到C:\ Users \ Owner.m2 \ repository並刪除其中的所有文件。確保保持你的月食接近。
  2. 打開eclipse並右鍵單擊您的項目,然後單擊Maven,然後在Update Project中。出現一個對話窗口,確保已經選擇了'clean projects'和'從pom.xml'更新項目配置'選項。

這應該清除項目中的所有錯誤。 :)

+0

也在我的mac上工作 – 2014-05-21 14:41:43

+0

它的工作原理!謝謝:) – jondinham 2014-09-11 04:54:42

+0

作品像一個魅力,TY – Yuri 2017-08-28 17:33:46

3

謝謝大家的幫助和指導。我自己得到了錯誤。我在代理網絡中,並且需要在apache maven的settings.xml文件中設置用戶標識和密碼。

+0

rDX你可以粘貼的片段給credienital \ – Sridhar 2014-06-26 09:56:11

4

您並不需要從.m2 \ repository目錄中刪除所有內容。只是'有問題的庫'的目錄,在你的示例YOUR_MAVEN_REPO.m2 \ repository \ org \ apache \ maven \ plugins \ maven-compiler-plugin和刪除2.3.2文件夾中。

然後右鍵單擊Eclipse和Maven-> Update Project中的項目。你可能會得到一個不同的錯誤,你必須重複這個過程。做3-4次,應該沒問題...

相關問題