I'm unable to get rid of a warning in a gradle 4.2 build:
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at build_d02ctf5wwx94ec3duxv44z2cn$_run_closure3$_closure6.doCall(...\build.gradle:56)
The projects build EJB jars and therefore the beans.xml file has to end up in the classes output folder. The recommended fix I found was to replace the line mentioned in the warning from:
sourceSets {
main {
output.resourcesDir = java.outputDir
}
test {
output.resourcesDir = java.outputDir
}
}
to:
sourceSets {
main {
output.resourcesDir = new File(buildDir, "classes/java/main")
}
test {
output.resourcesDir = new File(buildDir, "classes/java/main")
}
}
This resolves the warning and the beans.xml is where it needs to be. The issue I cannot figure out is there is another project in the build that depends on the ejb project and runs tests. Using the second approach it does not seem to recognize the beans.xml files (the weld injection in the tests dont work)
project structure:
build.gradle
/ejb-project (builds ejb's and copies beans.xml)
/it-test-project (uses Services from ejb)
/st-test-project
/war-project
/ear-project
The it-test-project contains a project() dependency and this sourceSets:
dependencies {
testCompile project(':ejb-project')
testRuntime project(':ejb-project')
}
sourceSets {
test {
// output.resourcesDir = new File(buildDir, "classes/java/main")
output.resourcesDir = output.classesDir
}
}
I don't understand how the injection in the test works in the variant above, but once I switch to the commented one does not. I assume it has to do with file references and the dependencies but I don't understand what would be the correct option here.
Any suggestions would be great :)