lapots
lapots

Reputation: 13415

could not resolve all dependencies for configuration ':compile'

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'
}

Upvotes: 7

Views: 24453

Answers (2)

Aman Chhabra
Aman Chhabra

Reputation: 627

I was facing this same issue. I fixed it by using local gradle distribution instead of the default gradle wrapper. This is how it goes, make sure that you have Gradle installed and setup(PATH variable).

Open IntelliJ. Goto File->setting->Build, Exec, Deployment->Build tools->Gradle and use local gradle distribution and add your Gradle Home. Apply changes and try to run it now.

Upvotes: 0

Radim
Radim

Reputation: 4808

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

Upvotes: 10

Related Questions