Skip to content

"languageVersion is final and cannot be changed" when using Gradle 8.3 and configuring the Java toolchain's language version #37342

@Eng-Fouad

Description

@Eng-Fouad

When using GraalVM gradle plugin (v0.9.26) with Spring Boot gradle plugin (v3.1.3), languageVersion cannot be set:

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(20)) // <-- the error occurs here
    }
}

graalvmNative {
    binaries {
        named("main") {
            javaLauncher.set(javaToolchains.launcherFor {
                languageVersion.set(JavaLanguageVersion.of(20))
            })
        }
    }
}

The following error occurs:

* What went wrong:
The value for property 'languageVersion' is final and cannot be changed any further.

Here is a reproducer by @jamesward: graalvm/native-build-tools#486 (comment)

Also, @melix explained how to fix it: graalvm/native-build-tools#486 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by anothertype: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions