Hello, I have a multi-project build in Gradle. This is the folder structure:
rootproject ---- subprojectA -------src ----------packages ----------xml ----------tests ---------------packages ---- subprojectB (…)
For some subprojects the tests read files from /xml subfolders and they execute fine via eclipse.
However, via Gradle command line they fail to find /xml folder and subfolders. A sample message is:
09:26:34.497 [DEBUG] [TestEventLogger]
Caused by:
09:26:34.497 [DEBUG] [TestEventLogger]
com.msdw.ird.refdata.storage.ReferenceDataStorageServiceException: ReferenceData directory does not exist xml/referencedata
Funny thing is that I get those files in the classpath once I print it:
(...)
09:24:16.112 [QUIET] [system.out] classpath damn file: "/a/nyn166f2/vol/nyn166f2v4/u_t1395154848/petulag/ird.trend/ird/trend/alternative/build/refdata/resources/main/xml/soap/ReloadReferenceData.xml"
09:24:16.112 [QUIET] [system.out] classpath damn file: "/a/nyn166f2/vol/nyn166f2v4/u_t1395154848/petulag/ird.trend/ird/trend/alternative/build/refdata/resources/main/xml/tests/stsRegionEnvSpecifics.xml"
(...)
I’ve been trying many different things, assuming I might have a classpath issue.
Here is how my build.gradle for the subproject looks like as of today:
sourceSets {
main {
java.srcDirs = [ 'src/packages']
resources.srcDirs = [ 'src/packages', 'src' ]
compileClasspath = compileClasspath + configurations.legacy
runtimeClasspath = project.sourceSets.main.compileClasspath +
project.sourceSets.test.compileClasspath +
fileTree("${buildDir}/resources/test") + fileTree("${buildDir}/resources/main") +
project.sourceSets.test.output + project.sourceSets.main.output
}
test {
java.srcDirs = [
'src/tests/packages']
resources.srcDirs = [ 'src'
]
runtimeClasspath = project.sourceSets.main.compileClasspath +
project.sourceSets.test.compileClasspath +
fileTree("${buildDir}/resources/test") + fileTree("${buildDir}/resources/main") +
project.sourceSets.test.output + project.sourceSets.main.output
}
}
dependencies {
compile project(':proj1)
compile project(':proj2)
compile project(':proj3)
compile group:'proprietarylib', name: 'hsqldb', version: 'v1', configuration: 'runtime'
}
test.doFirst {
println "Test classpath is:- "
sourceSets.test.runtimeClasspath.getFiles().each { file ->
println "classpath damn file: \"" + file + "\""
}
}
test {
systemProperty "testDataDir", "${buildDir}/resources/test"
include "**/*Test*.class"
systemProperty "main.tests.data.build.dir", "${buildDir}/resources/test"
}
Any ideas on what I am missing? Could it be some “weird” classloading issue?
Thanks! Petula