Java source package folder not validated by Gradle

With Gradle version 2.0 (and later maybe), when a Java class is defined within its proper package name but resides in a wrong directory not matching that package name, this throws a compile error with Javac, Gradle doesn’t. Is it a desired Gradle behavior?

Can you provide some more detail please.

Javac shouldn’t care about the structure of your source files.

Luke, you are right, javac doesn’t care about the packages source folder structure. My mistake. Gradle handling is coherent with what javac does.