I created a new Gradle project using gradle init. I've changed very few default properties. For an older project, classes are going to [project-dir]/build/classes, but in my new project, with a very similar build.gradle file, classes are going to [project-dir]/build/java/classes. The property for buildDir is [project-dir]/build. So where is [project-dir]/build/java coming from? I think that's causing me problems with the class loader.
(Nizet beat me to it with the link)
In the major number release Gradle 4 they allowed themselves to change the build directory to support multiple JVM languages. It was announced prior to the release.
Cache-safe mixed JVM language compilation In Gradle 3.5, projects that used both Java and another JVM language (like Groovy or Scala) would encounter problems when using the build cache. The class files created by multiple compilation tasks were all placed into the same output directory, which made determining the set of outputs to cache for each task difficult and would cause Gradle to cache the wrong outputs for each compilation task.
Gradle now uses separate output directories for each JVM language.
So you'll have /build/java, build/scala etc.