Dependency Management Not Working!


(Ghate) #1

Hi,

Can someone please help me out with the following issue?

apply plugin: ‘java’

repositories {
flatDir {
dirs '/scratch/app/product/jenkins/var/build/lib’
dirs ‘/scratch/app/product’
}
}

task compileINFRA(type: JavaCompile) {
delete (’/scratch/app/product/jenkins/var/build/buildspace/com.ofss.fc.infra’)
mkdir (’/scratch/app/product/jenkins/var/build/buildspace/com.ofss.fc.infra’)
source = fileTree(dir: ‘/scratch/app/product/jenkins_home/jobs/HOST/workspace/framework/com.ofss.fc.infra/src’, include: ‘**/*.java’)
destinationDir = file(’/scratch/app/product/jenkins/var/build/buildspace/com.ofss.fc.infra’)
classpath = files(’/scratch/app/product/jenkins/var/build/lib’)
}

dependencies {
compile name: 'javax.resource’
compile name: ‘com.ofss.fc.common’
}

task listJars << {
configurations.compile.each { File file -> println file.name }
}

task jarINFRA(type: Jar) {
archiveName = "com.ofss.fc.infra.jar"
from fileTree(dir: ‘/scratch/app/product/jenkins/var/build/buildspace/com.ofss.fc.infra’).matching{
include ‘**/*.class’
}
destinationDir = file(’/scratch/app/product/jenkins/var/build/lib’)
}

jarINFRA.dependsOn compileINFRA

This is my build.gradle file. compileINFRA gives me compilation errors since it does not get the reference of javax.resources.jar and com.ofss.fc.common.jar, although those jars are present at /scratch/app/product and /scratch/app/product/jenkins/var/build/lib locations respectively. Instead of using flatDir, if I give the reference using compile files() or compile flleDir in dependency section, issue remains the same. Also, listJars task gives me the name of jars used in dependency, but have no idea why it is not picked up during compileINFRA task. Stuck with the same issue for past 7 days. Suggestions on the issue will be appreciated.

Thanks in advance.