maven:传输文件时出错:连接被拒绝:连接

时间:2012-02-15 07:03:14

标签: maven maven-2

我在网络环境中工作。 我的网络IP地址是:

IE->工具 - >互联网选项 - >连接 - >局域网设置 - >使用自动配置脚本(已启用):地址: http://autocache.abc.com/

在IE设置中未指定

端口地址。

当我执行ping autocache.abc.com时,它提供以下ip地址:16.234.18.243

在settings.xml文件中,我启用了代理条目:

<proxy>
         <id>genproxy</id>
         <active>true</active>
         <protocol>http</protocol>
         <host>autocache.abc.com</host>
</proxy>

在主机上没有指定任何内容,即:IE-&gt; tools-&gt; connection-&gt; LAN设置 - &gt; advanced-&gt; http显示为空

如果我运行 mvn install 收到以下错误:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building home-app
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
Downloading: https://repository.jboss.org/nexus/content/repositories/releases//org/springframework/spring-parent/3.0.6.RELEASE/spring-parent-3.0.6.RELEASE.pom
[WARNING] Unable to get resource 'org.springframework:spring-parent:pom:3.0.6.RELEASE' from repository jboss (https://repository.jboss.org/nexus/content/repositories/releases/): Error transferring file: Connection refused: connect
Downloading: http://repository.springsource.com/maven/bundles/release/org/springframework/spring-parent/3.0.6.RELEASE/spring-parent-3.0.6.RELEASE.pom
[WARNING] Unable to get resource 'org.springframework:spring-parent:pom:3.0.6.RELEASE' from repository com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release): Error transferring file: Connection refused: connect
Downloading: http://repository.springsource.com/maven/bundles/external/org/springframework/spring-parent/3.0.6.RELEASE/spring-parent-3.0.6.RELEASE.pom
[WARNING] Unable to get resource 'org.springframework:spring-parent:pom:3.0.6.RELEASE' from repository com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external): Error transferring file: Connection refused: connect
Downloading: http://repo1.maven.org/maven2/org/springframework/spring-parent/3.0.6.RELEASE/spring-parent-3.0.6.RELEASE.pom
[WARNING] Unable to get resource 'org.springframework:spring-parent:pom:3.0.6.RELEASE' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection refused: connect
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.springframework:spring-orm:jar:3.0.6.RELEASE

Reason: Cannot find parent: org.springframework:spring-parent for project: org.springframework:spring-orm:jar:3.0.6.RELEASE for project org.springframework:spring-orm:jar:3.0.6.RELEASE


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Wed Feb 15 11:40:32 IST 2012
[INFO] Final Memory: 11M/27M
[INFO] ------------------------------------------------------------------------

如果我在没有网络连接的情况下运行mvn install,即在我的私人互联网连接上,它运行正常,只有网络代理问题。

我强烈认为这是主机问题,如果我将主机设为16.234.18.243而不是autocache.abc.com,仍会出现同样的错误。

我尝试创建新的本地存储库(即删除现有目录),但仍然存在同样的问题。

2 个答案:

答案 0 :(得分:4)

您指定的网址最有可能包含Proxy auto-config个文件。您需要下载它并查看其中指定的代理设置。

例如,文件内容

   function FindProxyForURL(url, host)
   {
      return "PROXY proxy.example.com:8080; DIRECT";
   }

表示您应该在端口8080上使用代理服务器proxy.example.com

有关更详细的示例,请参阅How to configure Maven behind an auto configured proxy

答案 1 :(得分:4)

1&GT;打开IE(或任何浏览器),

2 - ;将网址设为 http://autocache.abc.com/ (您已在上面给出)并输入,将以.pac格式下载文件,保存到桌面

3&GT;在textpad中打开.pac文件,识别PROXY:

在你的编辑器中,它会像:

   return "PROXY web-proxy.ind.abc.com:8080; PROXY proxy.sgp.abc.com:8080"; 

4&GT;转到Maven settings.xml并输入:

<proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>          
      <host>web-proxy.ind.abc.com</host>
      <port>8080</port>          
</proxy>

5个运行mvn:通过命令提示符安装或运行eclipse。

浏览maven-in-5-min-not-working