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’,

‘org.apache.ant:ant-launcher:1.8.2’,

‘org.apache.ant:ant:1.8.2’,

‘net.sourceforge.cobertura:cobertura:1.9.4.1’,

‘asm:asm:3.2’,

‘asm:asm-tree:3.1’,

‘org.apache.ant:ant:1.7.0’,

‘log4j:log4j:1.2.17’,

‘oro:oro:2.0.8’

} }

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/com.ibm.ws.runtime.jar’) } war {

classpath = sourceSets.main.output.classesDir }

task action << {

println “Building ProfileServer:” }

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

:PServer:coberturaInstrumentMain

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:1.9.4.1.

Required by:

PServer:PServer:unspecified

  • 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.