javagradle

Gradle and Java build jar


Does Gradle support backward compatibility for build Java? For example, can Gradle version 8.5 build Java 11 or Java 8 jar files?

Generally, how to choose Gradle to build a Java code for JDK 11?


Solution

  • Gradle 8.5 and Backward Compatibility for Building Java

    Role of Java Toolchains

    A key feature enabling Gradle's flexibility in handling different Java versions is the concept of Java toolchains.

    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(11)
        }
    }
    

    Resources and Further Reading