Set Java version with Gradle toolchain

Java version should be consistent for all tasks

"It has been possible to configure Gradle to build a project
with a different Java version than the one used to run Gradle. However,
it has required configuring each task like compilation, test, and javadoc separately.
Gradle 6.7 introduces “Java toolchain support”. In a nutshell,
it allows you to run Gradle with whatever version of Java you have installed,
while Gradle builds the project with the version of Java declared in a single place.
Gradle will automatically configure the build, detect already installed
JDKs and download the required JDK if it is not already installed."

More at https://blog.gradle.org/java-toolchains

Signed-off-by: Patryk Mis <foss@patrykmis.com>
This commit is contained in:
Patryk Mis
2023-05-02 12:22:49 +02:00
parent 4a078c5f42
commit d741967b5b

View File

@@ -39,6 +39,12 @@ project.ext {
]
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
android {
namespace 'com.aurora.store'
compileSdk 33