Maven构建失败:读取超时

时间:2013-01-18 13:05:31

标签: eclipse maven-3

我已经尝试了here找到的所有可能解决方案,包括:

  1. find~ / .m2 -name“* .lastUpdated”-exec grep -q“无法转移”{} \; -print -exec rm {} \;
  2. mvn -U clean
  3. 无论如何都不起作用,具体日志如下:

    btw:我试图从mkyong site

    运行struts2示例代码
    [DEBUG] =======================================================================
    [DEBUG] com.mkyong.common:Struts2Example:war:com.mkyong.common
    [DEBUG]    junit:junit:jar:3.8.1:test
    [DEBUG]    org.apache.struts:struts2-core:jar:2.1.8:compile
    [DEBUG]       com.opensymphony:xwork-core:jar:2.1.6:compile
    [DEBUG]          org.springframework:spring-test:jar:2.5.6:compile
    [DEBUG]             commons-logging:commons-logging:jar:1.1.1:compile
    [DEBUG]       org.freemarker:freemarker:jar:2.3.15:compile
    [DEBUG]       ognl:ognl:jar:2.7.3:compile
    [DEBUG]       commons-fileupload:commons-fileupload:jar:1.2.1:compile
    [DEBUG]       commons-io:commons-io:jar:1.3.2:compile
    [DEBUG]       com.sun:tools:jar:1.5.0:system
    [DEBUG]    org.apache.struts:struts2-convention-plugin:jar:2.1.8:compile
    [DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo
    .maven.apache.org/maven2
    Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-core/
    2.1.8/struts2-core-2.1.8.jar
    [DEBUG] Writing resolution tracking file D:\ProgramData\apache-maven-repo\.m2\re
    pository\org\apache\struts\struts2-core\2.1.8\struts2-core-2.1.8.jar.lastUpdated
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 52:31.162s
    [INFO] Finished at: Fri Jan 18 20:16:49 CST 2013
    [INFO] Final Memory: 2M/5M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project Struts2Example: Could not resolve depe
    ndencies for project com.mkyong.common:Struts2Example:war:com.mkyong.common: Cou
    ld not transfer artifact org.apache.struts:struts2-core:jar:2.1.8 from/to centra
    l (http://repo.maven.apache.org/maven2): GET request of: org/apache/struts/strut
    s2-core/2.1.8/struts2-core-2.1.8.jar from central failed: Read timed out -> [Hel
    p 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
    n project Struts2Example: Could not resolve dependencies for project com.mkyong.
    common:Struts2Example:war:com.mkyong.common: Could not transfer artifact org.apa
    che.struts:struts2-core:jar:2.1.8 from/to central (http://repo.maven.apache.org/
    maven2): GET request of: org/apache/struts/struts2-core/2.1.8/struts2-core-2.1.8
    .jar from central failed
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
    pendencies(LifecycleDependencyResolver.java:210)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resol
    veProjectDependencies(LifecycleDependencyResolver.java:117)
            at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAr
    eResolved(MojoExecutor.java:258)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:201)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:153)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:145)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:84)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:59)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    ild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    eStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: org.apache.maven.project.DependencyResolutionException: Could not res
    olve dependencies for project com.mkyong.common:Struts2Example:war:com.mkyong.co
    mmon: Could not transfer artifact org.apache.struts:struts2-core:jar:2.1.8 from/
    to central (http://repo.maven.apache.org/maven2): GET request of: org/apache/str
    uts/struts2-core/2.1.8/struts2-core-2.1.8.jar from central failed
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(D
    efaultProjectDependenciesResolver.java:189)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
    pendencies(LifecycleDependencyResolver.java:185)
            ... 22 more
    Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could n
    ot transfer artifact org.apache.struts:struts2-core:jar:2.1.8 from/to central (h
    ttp://repo.maven.apache.org/maven2): GET request of: org/apache/struts/struts2-c
    ore/2.1.8/struts2-core-2.1.8.jar from central failed
            at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
    ndencies(DefaultRepositorySystem.java:375)
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(D
    efaultProjectDependenciesResolver.java:183)
            ... 23 more
    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not
     transfer artifact org.apache.struts:struts2-core:jar:2.1.8 from/to central (htt
    p://repo.maven.apache.org/maven2): GET request of: org/apache/struts/struts2-cor
    e/2.1.8/struts2-core-2.1.8.jar from central failed
            at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
    aultArtifactResolver.java:538)
            at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
    facts(DefaultArtifactResolver.java:216)
            at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
    ndencies(DefaultRepositorySystem.java:358)
            ... 24 more
    Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not tra
    nsfer artifact org.apache.struts:struts2-core:jar:2.1.8 from/to central (http://
    repo.maven.apache.org/maven2): GET request of: org/apache/struts/struts2-core/2.
    1.8/struts2-core-2.1.8.jar from central failed
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
    agonRepositoryConnector.java:951)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
    agonRepositoryConnector.java:941)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.
    run(WagonRepositoryConnector.java:669)
            at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(Run
    nableErrorForwarder.java:60)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:908)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: org.apache.maven.wagon.TransferFailedException: GET request of: org/a
    pache/struts/struts2-core/2.1.8/struts2-core-2.1.8.jar from central failed
            at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
    49)
            at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
    10)
            at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:2
    87)
            at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97)
            at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.
    run(WagonRepositoryConnector.java:601)
            ... 4 more
    Caused by: java.net.SocketTimeoutException: Read timed out
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(SocketInputStream.java:129)
            at org.apache.maven.wagon.providers.http.httpclient.impl.io.AbstractSess
    ionInputBuffer.read(AbstractSessionInputBuffer.java:187)
            at org.apache.maven.wagon.providers.http.httpclient.impl.io.ContentLengt
    hInputStream.read(ContentLengthInputStream.java:176)
            at org.apache.maven.wagon.providers.http.httpclient.conn.EofSensorInputS
    tream.read(EofSensorInputStream.java:138)
            at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:493)
    
            at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
    39)
            ... 9 more
    

3 个答案:

答案 0 :(得分:1)

Read timed out表示您遇到网络问题。 repo.maven.apache.org已关闭(非常不可能),或者您的连接问题已解决。

答案 1 :(得分:0)

读取超时错误可能会在慢速网络上发生大的依赖性解析(您可能无法自行修复)。您还可以考虑这个other thread,在这里您将找到如何增加Maven Wagon超时,这将在这种情况下帮助您。

另请查看official documentation了解详情。

答案 2 :(得分:0)

但是使用wget我可以下载实例。它几乎停在这里..等待超过15分钟..

INFO] [INFO] --- maven-checkstyle-plugin:2.13:check(validate-checkstyle)@onos --- [DEBUG]使用http://repo.maven.apache.org/maven2的优先级为0.0的连接器WagonRepositoryConnector 正在下载:http://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-module-xhtml/1.2/doxia-module-xhtml-1.2.pom 2/2 KB

此致 巴拉