Hello all. I have been trying to get my mixed groovy and java project to compile without much success. Whenever I compile I am getting a NoClassDefFoundError for my Java classes. This is curious because the error would seem to indicate that the joint compilation isn’t processing Java files first.
I suspect that my source sets are not configured properly. My project has mixed groovy and java in src/main, src/test, and src/it, with three source sets configured for those. When I run gradle compileIntegrationTestGroovy is when I get the error. The class it complains about not finding is a java class inside of the src/it/java directory.
Why would the compilation ever fail to find a class it is supposed to be compiling? I am using gradle 1.8, groovy 2.2.2. Build script is below. Thanks!
sourceSets {
main {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/main/java']
}
resources {
exclude 'properties/spring.properties'
}
}
test {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/test/java']
}
}
integrationTest {
compileClasspath += sourceSets.test.compileClasspath + sourceSets.test.output
runtimeClasspath += output + sourceSets.test.runtimeClasspath + sourceSets.test.output
java {
srcDirs = []
}
groovy {
srcDirs = ['src/it/java']
}
resources {
srcDirs = ['src/it/resources']
}
}
}