Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build is failing [Could not resolve all dependencies for configuration ':compile'.]

I am trying for so many days to resolve this exception , followed many blogs and couldn't find solution. when I run a bundle.gradle by giving jettyRun as command enter image description here

I am getting an exception 



    **FAILURE: Build failed with an exception.

        * What went wrong:
        Could not resolve all dependencies for configuration ':compile'.
        > Could not resolve javax.servlet:servlet-api:2.5.
          Required by:
              :1-SimpleServlet:unspecified
           > Could not GET 'http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom'.
              > Connection to http://repo1.maven.org refused
        > Could not resolve org.apache.commons:commons-io:1.3.2.
          Required by:
              :1-SimpleServlet:unspecified
           > Could not GET 'http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom'.
              > Connection to http://repo1.maven.org refused**
like image 314
Prajyod Kumar Avatar asked Aug 11 '14 12:08

Prajyod Kumar


People also ask

Why is my Gradle build failing?

If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.

How do I clear all Gradle dependencies?

Generally, you can refresh dependencies in your cache with the command line option --refresh-dependencies. You can also delete the cached files under ~/. gradle/caches . With the next build Gradle would attempt to download them again.


2 Answers

The real error is this:

Connection to http://repo1.maven.org refused

Gradle needs to download the dependencies listed in the error message to be able to compile the project.

You're probably behind a firewall or your Internet connection isn't working. You need to make sure Gradle can access http://repo1.maven.org.

Note: Maven Central (http://repo1.maven.org) can be accessed with a browser. If you see the message "Browsing for this directory has been disabled" that means your browser could connect to the server (the error is a special message my Maven Central, not a standard HTTP error message).

If you see this but Maven or Gradle fail, then you need to check your browser's/OS's proxy settings and configure your tool accordingly.

Related:

  • How do I use Maven through a proxy?
  • Gradle proxy configuration
like image 170
Aaron Digulla Avatar answered Oct 08 '22 16:10

Aaron Digulla


Using --refresh-dependencies switch with gradle, helped me to resolve this issue.

like image 43
phoenix Avatar answered Oct 08 '22 16:10

phoenix