2012-12-27 75 views
0

我是maven構建工具的新手,但我無法爲代理服務器配置maven。爲代理配置maven

/usr/share/maven/settings.xml 我添加了以下幾行:

<proxies> 
    <proxy> 
     <active>true</active> 
     <protocol>http</protocol> 
     <host>proxy.foo.bar.com (http://proxy.foo.bar.com/)</host> 
     <port>911</port> 
    </proxy> 
    <proxy> 
     <active>true</active> 
     <protocol>https</protocol> 
     <host>proxy.foo.bar.com (https://proxy.foo.bar.com/)</host> 
     <port>911</port> 
    </proxy> 
<proxy> 
</proxies> 

但是當我做MVN包。 我得到的錯誤:

Downloading: http://repo1.maven.org/maven2 (http://repo1.maven.org/maven2)/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.245s 
[INFO] Finished at: Thu Dec 27 10:10:30 PST 2012 
[INFO] Final Memory: 3M/87M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.3: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.3 from/to Central (http://repo1.maven.org/maven2 (http://repo1.maven.org/maven2)): IllegalArgumentException: Illegal character in path at index 29: http://repo1.maven.org/maven2 (http://repo1.maven.org/maven2)/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom -> [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 

我該如何解決這個問題?

+2

刪除'(http://proxy.foo.bar.com/)'字符串並嘗試 –

+0

@AbhinavSarkar:不行.. :( – Fraz

+0

請發佈您的整個settings.xml文件。看起來您可能會沒有maven central的正確條目。 – gregwhitaker

回答

3

代理入口的主機不應該包含括號。

它應該看起來像。

<host>proxy.foo.bar.com</host> 

您可以在控制檯輸出的第一部分看到括號被添加到路徑中。

Downloading: http://repo1.maven.org/maven2 (http://repo1.maven.org/maven2)/org/apache/maven/plugins/maven-resources-plugin/2.3/ 

它應該看起來像

Downloading: http://repo1.maven.org/maven2 http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/ 
0

你已經正確配置,就像你已經正確配置的路徑,你的代理路徑Maven的中央存儲庫。條目應該看起來像標準的URL,不包含任何括號。