Maven依赖项超时设置 [英] Maven dependency timeout settings

查看:126
本文介绍了Maven依赖项超时设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven在下载依赖项时报告超时异常,因为它的默认超时为60000,但就我而言,我需要增加,因为(我工作的环境已建立了一个中介服务器,该服务器首先将所有文件下载到其自己的服务器上然后我的机器从该中间服务器获取那些下载的文件). 现在出现了问题,如果依赖关系太大,仅仅花费了超过60000毫秒,则食道爆发并带有以下异常

Maven reports timeout exception while downloading dependencies, as it's default time out is 60000, but in my case I need to increase because ( The environment where I am working has established an intermediary server that first download all the file to it's own server and my machine get those downloaded file from that intermediary server). Now here the problem comes, if the dependency is too large simply that takes more than 60000 mili seconds then eclipse burst with the following exception

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Arquillian Persistence Extension Aggregator
[INFO] Arquillian Persistence Extension API
[INFO] Arquillian Persistence Extension SPI
[INFO] Arquillian Persistence Extension Core
[INFO] Arquillian Persistence Extension DBUnit Integration
[INFO] Arquillian Persistence Extension Integration Tests
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Arquillian Persistence Extension Aggregator 1.0.0.Final-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-java-version) @ arquillian-persistence-parent ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven-version) @ arquillian-persistence-parent ---
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:unpack (unpack) @ arquillian-persistence-parent ---
[INFO] Configured Artifact: org.wildfly:wildfly-dist:8.0.0.Final:zip
Downloading: http://repo.maven.apache.org/maven2/org/wildfly/wildfly-dist/8.0.0.Final/wildfly-dist-8.0.0.Final.zip
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Arquillian Persistence Extension Aggregator ....... FAILURE [2:11.315s]
[INFO] Arquillian Persistence Extension API .............. SKIPPED
[INFO] Arquillian Persistence Extension SPI .............. SKIPPED
[INFO] Arquillian Persistence Extension Core ............. SKIPPED
[INFO] Arquillian Persistence Extension DBUnit Integration  SKIPPED
[INFO] Arquillian Persistence Extension Integration Tests  SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:11.908s
[INFO] Finished at: Wed May 07 11:27:41 PKT 2014
[INFO] Final Memory: 22M/177M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.3:unpack (unpack) on project arquillian-persistence-parent: Unable to resolve artifa
ct. Could not transfer artifact org.wildfly:wildfly-dist:zip:8.0.0.Final from/to central (http://repo.maven.apache.org/maven2): No response received after 60000
[ERROR] org.wildfly:wildfly-dist:zip:8.0.0.Final
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] -> [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/MojoExecutionException

60000之后没有收到响应,此行会造成麻烦.

No response received after 60000 , this line creates trouble.

作为解决方案:

我正在将 settings.xml 用于以下设置

<settings>
  <servers>
    <server>
      <id>central</id>
      <configuration>
            <timeout>120000</timeout>
      </configuration>
    </server>
  </servers>
</settings>

我确定settings.xml的路径正确.

while I am sure the path of the settings.xml is correct.

不幸的是,它不起作用.

Unfortunately it does not work.

推荐答案

根据此Maven指南有一种设置超时的新方法. 我更改了我的~/settings.xml,现在看起来像这样...

According to this Maven guide there's a new way to set up timeouts. I changed my ~/settings.xml that now reads like that...

<server>
  <id>central</id>
  <configuration>
    <httpConfiguration>
      <all>
        <connectionTimeout>120000</connectionTimeout>
        <readTimeout>120000</readTimeout>
      </all>
    </httpConfiguration>
  </configuration>
</server>

在我看来,这很有效.我尝试了一个不存在的存储库,并且当我将两个超时都设置为5000时,它似乎比以前更快地失败了.您可以尝试一下吗?

It seems to work in my case. I tried with an unexisting repository and it seems to fail far quicker than before, when I set both timeouts to 5000. Can you give it a try ?

这篇关于Maven依赖项超时设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆