Gradle with local libraries is not working. Same script works with maven repo

I am getting this error with gradle. I changed the script to NOT use maven repo, and instead downloaded required jars into lib folder of the project.

But it doesnt seem to work. Please help.

//apply plugin: ‘java’ apply plugin: ‘war’ apply plugin: ‘eclipse-wtp’

project.webAppDirName=“WebContent” archivesBaseName=“ProfileServer”

compileJava {

sourceCompatibility = JavaVersion.VERSION_1_6

targetCompatibility = JavaVersion.VERSION_1_6 }

def webInfPath = “WebContent/WEB-INF/lib”

configurations.all {

transitive = false }

buildscript {

repositories {

flatDir {

dirs ‘WebContent/WEB-INF/lib’



dependencies {

classpath ‘:gradle-cobertura-plugin:1.1.1’,









} }

apply plugin: ‘cobertura’

cobertura {

format = ‘xml’

includes = [’/*.java’, '/*.groovy’]

excludes = [‘com/thirdparty/**/.’] }

dependencies { // Compile time dependencies read from local directory

compile fileTree(dir: webInfPath, include: ‘*.jar’)

testCompile ‘junit:junit:4.8.2’

providedCompile files(‘libs/’) } war {

classpath = sourceSets.main.output.classesDir }

task action << {

println “Building ProfileServer:” }

ERROR: --------------------------------------------------------------------------------------------------------------


FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all dependencies for configuration ‘:PServer:coberturaAnt’. > Could not find net.sourceforge.cobertura:cobertura:

Required by:


  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Please format the code by wrapping it with HTML code tags (repost if necessary), and include a file listing of the ‘lib’ directory. One problem I can spot is that a repository declaration outside ‘buildscript {}’ is missing, although that’s not the cause of the current problem.

When I added that respository declaration outside the buildscript, I see this error.

  • What went wrong: Execution failed for task ‘:ProfileServer:coberturaInstrumentMain’. > Error instrumenting classes. See messages above.

This means that all declared buildscript dependencies were resolved successfully.