Maven clean install fails with connection timed out:connect error

48,506

Solution 1

DependencyResolutionException

(source: Maven Confluence)

This error generally occurs when Maven could not download dependencies. Possible causes for this error are:

  1. The POM misses the declaration of the <repository> which hosts the artifact.
  2. The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your ${user.home}/.m2/settings.xml contains a <server> declaration whose <id> matches the <id> of the remote repository to use. See the Maven Settings Reference for more details.
  3. The remote repository in question uses SSL and the JVM running Maven does not trust the certificate of the server.
  4. There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
  5. You have configured Maven to perform strict checksum validation and the files to download got corrupted.
  6. Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.
  7. In Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure. To force a refresh add -U to the command line.

In case of a general network-related problem, you could also consult the following articles:

Solution 2

I had this problem, where maven couldn't download anything. After some googling and some luck, I deleted the file ~/.m2/server.xml. That fixed the problem. I haven't touched that file before, not sure what the problem was.

Solution 3

Your remote repositories all have the domain maven.apps.com, is that a domain in your intranet? Is Nexus running as a mirror for Maven central?

If not, you can try removing settings.xml temporarily and see if the default settings succeed.

Share:
48,506
user3393658
Author by

user3393658

Updated on March 10, 2021

Comments

  • user3393658
    user3393658 about 3 years

    I tried maven clean install on my project and I every time I get the following error

    Maven version 2.2.1 JDK 1.7

    F:\Wealth>"C:\Program Files\apache-maven-2.2.1\bin\mvn.bat" cl
    ean install -U
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building polo
    [INFO]    task-segment: [clean, install]
    [INFO] ------------------------------------------------------------------------
    Downloading: http://maven.apps.com/maven2/org/apache/maven/plugins/maven-cle
    an-plugin/2.2/maven-clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki (http://maven.apps.com/maven2): Error transferring file: Connection timed out: connect
    Downloading: http://maven.apps.com/maven/org.apache.maven.plugins/poms/maven
    -clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki-legacy (http://maven.apps.com/maven): Error transferring file: Connection timed out: connect
    Downloading: http://maven.apps.com/maven2//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
    Downloading: http://maven.apps.com/maven2/org/apache/maven/plugins/maven-cle
    an-plugin/2.2/maven-clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki (http://maven.apps.com/maven2): Error transferring file: Connection timed out: connect
    Downloading: http://maven.apps.com/maven/org.apache.maven.plugins/poms/maven
    -clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki-legacy (http://maven.apps.com/maven): Error transferring file: Connection timed out: connect
    Downloading: http://maven.apps.com/maven2//org/apache/maven/plugins/maven-cl
    ean-plugin/2.2/maven-clean-plugin-2.2.pom
    [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Error building POM (may not be this project's POM).
    
    
    Project ID: org.apache.maven.plugins:maven-clean-plugin
    
    Reason: POM 'org.apache.maven.plugins:maven-clean-plugin' not found in repository: Unable to download the artifact from any repository
    
      org.apache.maven.plugins:maven-clean-plugin:pom:2.2
    
    from the specified remote repositories:
      nunki-legacy (http://maven.apps.com/maven),
      central (http://maven.apps.com/maven2/),
      nunki (http://maven.apps.com/maven2)
    
     for project org.apache.maven.plugins:maven-clean-plugin

    I have checked the proxy settings in settings.xml and I my feeling is that's the problem. But I have tried the same proxy settings to build other open source software projects and the build was success. But for this project, I see this error.

    Can someone give an idea on this problem.

    • khmarbaise
      khmarbaise about 9 years
      Start use Maven 3 and not Maven 2 anymore cause it's EoL
    • user3393658
      user3393658 about 9 years
      Okay, but I have to build this project using Maven 2.X, as its a must in the organization
  • user3393658
    user3393658 about 9 years
    Yes, maven.apps.com is the domain on intranet and I do not have Nexus running as mirror. Also, trying without settings.xml gives same error. Unable to download artifact from central (repo1.maven.org/maven2)
  • P-a Bäckström
    P-a Bäckström about 9 years
    OK, from what I understand, your intranet does not allow outbound connections other than through a proxy. The problem here seems to be that all repositories defined in your settings.xml points to maven.apps.com on your intranet. The server at said address does not respond, all you get is a connection timeout error. What you should try next, is to edit your settings.xml file, and comment out all things regarding repositories but leave the proxy configuration as is.
  • user3393658
    user3393658 about 9 years
    I will try this, how ever I am running this on our remote server, so I downloaded Source code on to my local desktop machine and tried to build from there. using the same settings.xml file my local machine is able to download all artifacts and dependencies but there was some compile error. But I have this problem on Server machine
  • P-a Bäckström
    P-a Bäckström about 9 years
    Probable cause - if this is a production server it is most likely in setup in a DMZ where no access to Internet nor your proxy is allowed.
  • user3393658
    user3393658 about 9 years
    Its not a production server, I use this server for accessing other data sites. Connect to internet using Proxy settings. I have run maven clean install on a different open source software and it has no problem, but while trying to access this domain on intranet, I see this problem
  • fiorentinoing
    fiorentinoing almost 7 years
    setup the correct proxy in the ${user.home}/.m2/settings.xml file solved the issue.