I upgraded to Eclipse 2020-06 a couple months ago, and ever since then my Gradle files appear to be validated as Java files rather than as Gradle files:
They also have the Java class file icon next to their name in the explorer, but I'm not sure that was not the case before:
As an example, here is failingBuild.gradle:
defaultTasks 'build'
task build {
doLast {
println "stopping the build by throwing an exception..."
throw new GradleException('deliberately failing the build')
println "this should not be printed"
}
}
My Gradle Unit Tests also have been failing because ClassLoader.getSystemResource() returns null when attempting to get these files as System Resources.
As far as I know, I haven't changed anything about Eclipse other than update it. I'd really like Eclipse to process these Gradle files properly again, i.e. as something other than Java files.
Since people asked for it, the project structure:
These gradle files are part of our unit tests. they are used to test whether our product can properly start gradle-based build scripts and verify the build succeeded or failed. As such, they are located in a source directory. One thing I've noticed is that these scripts can't be loaded as system resources with the below code:
buildFile = new File(ClassLoader
.getSystemResource("be/ikan/scm4all/util/builders/gradle/testBuild.gradle")
.getPath());
This may or may not be relevant.