Question

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'
}
Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top