Программисты JAVA общаются здесь
Anonymous
Как установить задачу compileJava (11) и задачу compileKotlin (1.8) целевой совместимости jvm с одной и той же версией J
Сообщение
Anonymous » 03 май 2024, 07:53
Build.gradle.kts
Код: Выделить всё
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath ("com.android.tools.build:gradle:7.0.2")
classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${Versions.spotbugsGradlePluginVersion}")
classpath("se.bjurr.violations:violations-gradle-plugin:${Versions.violationsVersion}")
}
}
//android {
// compileOptions {
// sourceCompatibility = JavaVersion.VERSION_11
// targetCompatibility = JavaVersion.VERSION_11
// }
//
// kotlinOptions {
// jvmTarget = JavaVersion.VERSION_11.toString()
// }
//}
plugins {
`maven-publish`
`java-gradle-plugin`
`kotlin-dsl`
id ("io.gitlab.arturbosch.detekt") version ("1.18.1")
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
compileOnly(gradleApi())
testImplementation(gradleTestKit())
testImplementation("junit:junit:${Versions.jUnitVersion}")
}
val generatedSources = tasks.register("generateSources")
Я получаю следующую ошибку:
ОШИБКА: задача «compileJava» (текущая цель — 11) и «compileKotlin» ' задача (текущая целевая версия – 1.8) Целевая совместимость jvm должна быть установлена на ту же версию Java.
Когда я раскомментирую android {, Я получаю:
Ошибка: ошибки компиляции скрипта:
Код: Выделить всё
Line 15: android {
^ Unresolved reference: android
Подробнее здесь:
https://stackoverflow.com/questions/690 ... target-com
1714711986
Anonymous
Build.gradle.kts [code]buildscript { repositories { google() mavenCentral() gradlePluginPortal() } dependencies { classpath ("com.android.tools.build:gradle:7.0.2") classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30") classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${Versions.spotbugsGradlePluginVersion}") classpath("se.bjurr.violations:violations-gradle-plugin:${Versions.violationsVersion}") } } //android { // compileOptions { // sourceCompatibility = JavaVersion.VERSION_11 // targetCompatibility = JavaVersion.VERSION_11 // } // // kotlinOptions { // jvmTarget = JavaVersion.VERSION_11.toString() // } //} plugins { `maven-publish` `java-gradle-plugin` `kotlin-dsl` id ("io.gitlab.arturbosch.detekt") version ("1.18.1") } repositories { google() mavenCentral() gradlePluginPortal() } dependencies { compileOnly(gradleApi()) testImplementation(gradleTestKit()) testImplementation("junit:junit:${Versions.jUnitVersion}") } val generatedSources = tasks.register("generateSources") [/code] Я получаю следующую ошибку: ОШИБКА: задача «compileJava» (текущая цель — 11) и «compileKotlin» ' задача (текущая целевая версия – 1.8) Целевая совместимость jvm должна быть установлена на ту же версию Java. Когда я раскомментирую android {, Я получаю: Ошибка: ошибки компиляции скрипта: [code] Line 15: android { ^ Unresolved reference: android [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/69079963/how-to-set-compilejava-task-11-and-compilekotlin-task-1-8-jvm-target-com[/url]