2010-11-18 48 views
0
創建

我試過以下命令其正常工作

 
C:\Documents and Settings\users>mvn -v 
Apache Maven 3.0 (r1004208; 2010-10-04 17:20:56+0530) 
Java version: 1.6.0_21 
Java home: C:\Program Files\Java\jdk1.6.0_21\jre 
Default locale: en_US, platform encoding: Cp1252 
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" 

有一次我試圖編譯簡單HelloWorld.java程序。它給我下面的錯誤...

 
C:\my-app>mvn compile 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Quick Start Archetype 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: repo1.maven.org/maven2/org/apache/maven/plugins/maven-resour 
ces-plugin/2.4.3/maven-resources-plugin-2.4.3.jar 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.454s 
[INFO] Finished at: Thu Nov 18 13:08:50 IST 2010 
[INFO] Final Memory: 1M/15M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of i 
ts dependencies could not be resolved: Could not transfer artifact org.apache.ma 
ven.plugins:maven-resources-plugin:jar:2.4.3 from central (http://repo1.maven.or 
g/maven2): Error transferring file: Connection refused: connect -> [Help 1] 
[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/PluginResoluti 
onException 

請任何人用適當的解決方案更新我。

回答

0

首先,你真的應該更好地設置你的問題的格式。只需剪切和粘貼,不用考慮提交時的外觀如何,並不能幫助您快速簡潔地回答問題。

二,你的問題到底是什麼?你的主題說了一件事,但你的文字說了另一件事。

現在,我將刺探你的主題和你的文本。

就主題而言,settings.xml文件不會由Maven自動創建。你必須創建並按照你想要的方式進行配置。有關settings.xml的更多信息,請參閱此website

就文字而言,看起來像您無權訪問Maven repo。這可能是因爲一些事情。最明顯的是:

  • 存儲庫未在項目的pom.xml文件中指定,如here所述。
  • 由於防火牆或互聯網連接原因,運行此服務器的服務器無權訪問http://repo1.maven.org/maven2/
1

仔細檢查:

  • 這不是間歇性的問題
  • 你沒有得到不好的元數據(並清理整個~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/
相關問題