Gradle, “sourceCompatibility” vs “targetCompatibility”?

targetCompatibility and sourceCompatibility maps to -target release and -source release in javac. Source is basically the source language level and target is the level of the bytecode that is generated.

More details can be found in the Cross-Compilation Options for javac section of Tools Reference for Java 8, for Java 11, for Java 17, or for Java 19.

Leave a Comment