Closed vabean closed 8 months ago
Ah, it turns out this is something that near-silently was changed in Gradle 8.x; it worked earlier this year on Gradle 7.x. The only thing needed to fix this is to insert some extra configuration into the start of your settings.gradle
file (not any of the build.gradle
files!):
plugins {
id('org.gradle.toolchains.foojay-resolver-convention') version '0.7.0'
}
// Below this you should have the previous contents of settings.gradle, with the list of subprojects.
While it's reasonable to be cautious with any downloading plugin, this specific third-party plugin is actually recommended in the Gradle docs: https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories It handles downloading a toolchain, which usually means Java 11 for us, and using it throughout the build. Kotlin and Java need to be configured to use identical versions for Kotlin to work, and this was the most sane way I found to do that. The toolchain for, let's say, 11, gets downloaded once into ~/.gradle/
(that is, in the .gradle in your user home folder), and will be reused by any other Gradle projects that use toolchains. JDKs from toolchains can also be treated as normal Java installations; you could set one as your JAVA_HOME for instance.
I've already added the code for settings.gradle in new projects, but there isn't a release yet with it. Should be soon, probably. Thanks for finding this; I'll close the issue since the code is already present and is just waiting for a release.
When creating a project with gdx-liftoff-1.12.1.4 and selecting Kotlin under Languages, I get this error when trying to open/build the project
Creating a project without selecting Kotlin does not produce this error.