Skip to content

Java toolchains in build.gradle #15413

@gsartori

Description

@gsartori

Feature description

Since newer Gradle versions (7+) are pushing the Java Toolchains approach as the standard way to manage JDK versions, it might make sense for our templates to adopt that syntax by default.

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

Right now we use:

compileJava.options.release = 25

which works for bytecode targeting but doesn’t guarantee the JDK actually used for compilation, tests, and runtime tasks. Toolchains give us a more consistent and reproducible setup (and automatic JDK provisioning when needed), which feels like a better fit for newbies.

Not a big deal of course, just thought it could be a nice improvement for new apps going forward.

PS: I'm sorry at the moment I don't have bandwidth to make a PR and test it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions