diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle index 7ec133f2d2..a83bfa1208 100644 --- a/gradle/published-java-module.gradle +++ b/gradle/published-java-module.gradle @@ -98,6 +98,16 @@ javadoc { 'http://docs.jboss.org/cdi/api/2.0/', 'https://javaee.github.io/javaee-spec/javadocs/' ] + //Workaround to get the JVM version while ignoring the Gradle Enums for versions, + //as they never support upcoming JVM versions (doesn't have a isJava12Compatible() yet ) + int majorJVMVersionInt = Integer.valueOf(JavaVersion.current().toString()); + if ( majorJVMVersionInt >= 12 ) { + //The need to set `--source 8` applies to all JVMs after 11, and also to 11 + //but after excluding the first two builds; see also specific comments on + // https://bugs.openjdk.java.net/browse/JDK-8212233?focusedCommentId=14245762 + System.out.println( "Forcing Javadoc in Java 8 compatible mode" ); + options.addStringOption( '-source', '8' ) + } if ( JavaVersion.current().isJava8Compatible() ) { options.addStringOption( 'Xdoclint:none', '-quiet' )