0

我是 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

我该如何解决这个问题?

4

2 回答 2

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/
于 2012-12-27T18:48:34.163 回答
0

您错误地配置了 Maven 中央存储库的路径,就像您错误地配置了代理的路径一样。这些条目应该看起来就像标准 url,并且不包含任何括号。

于 2012-12-27T18:57:30.570 回答