diff --git a/build.xml b/build.xml
index 9228d17..5500678 100644
--- a/build.xml
+++ b/build.xml
@@ -660,6 +660,7 @@
+
diff --git a/src/main/groovy/de/thetaphi/forbiddenapis/gradle/ForbiddenApisPlugin.groovy b/src/main/groovy/de/thetaphi/forbiddenapis/gradle/ForbiddenApisPlugin.groovy
index abc8185..875ea9d 100644
--- a/src/main/groovy/de/thetaphi/forbiddenapis/gradle/ForbiddenApisPlugin.groovy
+++ b/src/main/groovy/de/thetaphi/forbiddenapis/gradle/ForbiddenApisPlugin.groovy
@@ -47,8 +47,8 @@ public class ForbiddenApisPlugin extends ForbiddenApisPluginBase {
}
// Gradle is buggy with it's JavaVersion enum: We use majorVersion property before Java 11 (6,7,8,9,10) and for later we use toString() to be future-proof:
- Closure targetCompatibilityGetter = { (project.targetCompatibility?.hasProperty('java11Compatible') && project.targetCompatibility?.java11Compatible) ?
- project.targetCompatibility.toString() : project.targetCompatibility?.majorVersion };
+ Closure targetCompatibilityGetter = { (project.java.targetCompatibility?.hasProperty('java11Compatible') && project.java.targetCompatibility?.java11Compatible) ?
+ project.java.targetCompatibility.toString() : project.java.targetCompatibility?.majorVersion };
// Define our tasks (one for each SourceSet):
project.sourceSets.all{ sourceSet ->
diff --git a/src/test/gradle/build.gradle b/src/test/gradle/build.gradle
index 75e09bc..ab2b9a9 100644
--- a/src/test/gradle/build.gradle
+++ b/src/test/gradle/build.gradle
@@ -29,7 +29,9 @@ buildscript {
apply plugin: 'java'
apply plugin: 'de.thetaphi.forbiddenapis'
-sourceCompatibility = forbiddenSourceCompatibility
+java {
+ sourceCompatibility = forbiddenSourceCompatibility
+}
sourceSets {
main {