Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could not resolve all dependencies for configuration ':compile'

Tags:

gradle

To study Gradle I am using the book Gradle in action. There was an example of dependency definition.

dependencies {
      compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
} 

But when I do in console gradle build I've got an error enter image description here

What is the problem? My whole .gradle file looks like this

apply plugin: 'java'

dependencies {
     compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
}
like image 204
lapots Avatar asked May 12 '14 12:05

lapots


People also ask

Could not resolve all dependencies for configuration compile Gradle?

This is because of slow internet connection or you haven't configure proxy settings correctly. Gradle needs to download some dependencies , if it cant access the repository it fires this error. All you have to do is check your internet connection and make sure gradle can access the maven repository. Save this answer.

How do I resolve Gradle dependencies?

Given a required dependency, with a version, Gradle attempts to resolve the dependency by searching for the module the dependency points at. Each repository is inspected in order. Depending on the type of repository, Gradle looks for metadata files describing the module ( .

How do you resolve a dependency?

Resolve dependencies using action method injection You might often need to inject many different services in your controller. If you're using constructor injection, you would then have to specify several parameters in the constructor. A better solution to this is to use IServiceProvider.

What is compile dependency in Gradle?

Compile − The dependencies required to compile the production source of the project. Runtime − The dependencies required by the production classes at runtime. By default, it also includes the compile time dependencies. Test Compile − The dependencies required to compile the test source of the project.


1 Answers

You did not tell Gradle where to find commons-lang3 library. Easy fix is to add the following to your build script:

repositories {
    mavenCentral()
}

Of course you can find this piece of information in documentation - http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html#N10608

like image 131
Radim Avatar answered Sep 28 '22 09:09

Radim