【问题标题】:maven: Error transferring file: Connection refused: connectmaven:传输文件时出错:连接被拒绝:连接
【发布时间】:2012-02-15 07:03:13
【问题描述】:

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

IE->tools->internet options->connections->LAN settings->Use Automatic configuration script(enabled): 地址: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主机上没有指定任何内容,即:IE->tools->connection->LAN settings->advanced->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,仍然会出现同样的错误。

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

【问题讨论】:

    标签: maven maven-2


    【解决方案1】:

    1> 打开 IE(或任何浏览器),

    2> 将 url 输入为 http://autocache.abc.com/(上面已经给出)并输入,将下载一个 .pac 格式的文件,保存到桌面

    3> 在 textpad 中打开 .pac 文件,识别 PROXY:

    在你的编辑器中,它会是这样的:

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

    4> 进入 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:install 或通过 eclipse 运行。

    通过maven-in-5-min-not-working

    【讨论】:

      【解决方案2】:

      您指定的 URL 很可能包含 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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-07-31
        • 2016-08-06
        • 1970-01-01
        • 2017-08-08
        • 2014-04-07
        • 2015-03-14
        • 2016-09-10
        相关资源
        最近更新 更多