Slackbot
02/16/2024, 4:44 PMJohn
02/16/2024, 4:44 PMplugins { kotlin("jvm") version("x") apply(false) }John
02/16/2024, 4:45 PMJohn
02/16/2024, 4:47 PMtarget.gradle.rootProject{
plugins {
kotlin("jvm").version("").apply(false)
}
}
but that plugins call is marked deprecatedJohn
02/16/2024, 4:48 PMUsing 'plugins(PluginDependenciesSpec.() -> Unit): Nothing' is an error. The plugins {} block must not be used here. If you need to apply a plugin imperatively, please use apply<PluginType>() or apply(plugin = "id") instead.Adam
02/16/2024, 4:49 PMpluginManagement {}?
https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_managementJohn
02/16/2024, 4:51 PMJohn
02/16/2024, 5:04 PMtarget.gradle.beforeSettings {
pluginManagement {
plugins {
id("org.jetbrains.kotlin.jvm").version("1.9.20")
}
}
}
then
target.gradle.beforeProject {
plugins.apply("org.jetbrains.kotlin.jvm")
}John
02/16/2024, 5:05 PM> Plugin with id 'org.jetbrains.kotlin.jvm' not found.Adam
02/16/2024, 5:05 PMtarget.gradle.beforeSettings {}?John
02/16/2024, 5:07 PMVampire
02/16/2024, 5:08 PMpluginManagement { plugins { ... } } only defines default versions if the plugin is applied in a plugins block somewhere without version, it does not add it to any classpath, so apply() cannot find itVampire
02/16/2024, 5:09 PMVampire
02/16/2024, 5:09 PMVampire
02/16/2024, 5:09 PMJohn
02/16/2024, 5:12 PMtarget.gradle.beforeProject {
plugins {
kotlin("jvm")
}
}John
02/16/2024, 5:12 PMJohn
02/16/2024, 5:12 PMVampire
02/16/2024, 5:13 PMVampire
02/16/2024, 5:13 PMruntimeOnly for example if you do not use the classes otherwiseJohn
02/16/2024, 5:13 PMJohn
02/16/2024, 5:18 PMplugins { } from a settings plugin apparently?Vampire
02/16/2024, 5:18 PMVampire
02/16/2024, 5:19 PMclasspath just like before the plugins { ... } blockVampire
02/16/2024, 5:19 PMJohn
02/16/2024, 5:31 PMtarget.gradle.settingsEvaluated {
target.buildscript.dependencies.add("classpath", "org.jetbrains.kotlin:kotlin-gradle-plugin:"+extension.kotlinVersion.get())
}John
02/16/2024, 5:31 PMJohn
02/16/2024, 5:34 PMtarget.gradle.settingsEvaluated {
target.gradle.rootProject.buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:"+extension.kotlinVersion.get())
}
}John
02/16/2024, 5:35 PMThe root project is not yet available for build.John
02/16/2024, 5:38 PMtarget.gradle.rootProject {
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:"+extension.kotlinVersion.get())
}
}
}John
02/16/2024, 5:38 PMJohn
02/16/2024, 6:12 PMmadisp
02/16/2024, 7:44 PMproject.pluginManager.apply ?madisp
02/16/2024, 7:46 PMKotlinConvention :
class KotlinConvention : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jetbrains.kotlin.jvm")
apply("org.jetbrains.kotlinx.kover")
apply("com.squareup.sort-dependencies")
}
// configure other stuff
}
}
}John
02/16/2024, 8:35 PMmadisp
02/16/2024, 8:43 PMmadisp
02/16/2024, 8:44 PMsettings.gradle.kts?
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.22" apply false
}John
02/16/2024, 8:59 PMmadisp
02/16/2024, 9:00 PMsettings.gradle.kts?Vampire
02/16/2024, 9:05 PMmadisp
02/16/2024, 9:06 PMtarget.gradle.rootProject.buildscript bits?Vampire
02/16/2024, 9:06 PMJohn
02/16/2024, 9:06 PMJohn
02/16/2024, 9:07 PMmadisp
02/16/2024, 9:15 PMgradle.beforeProject {
if (this == this.rootProject) {
buildscript.dependencies.add("classpath", "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.9.22")
}
}John
02/16/2024, 9:16 PMmadisp
02/16/2024, 9:16 PMbuildscript {} closure, as Gradle will try to lift these outmadisp
02/16/2024, 9:16 PMpluginManagementmadisp
02/16/2024, 9:16 PMclasspath will become the versionJohn
02/16/2024, 9:17 PMJohn
02/16/2024, 9:20 PMmadisp
02/16/2024, 9:20 PMJohn
02/16/2024, 9:20 PMJohn
02/16/2024, 9:21 PMVampire
02/17/2024, 11:47 AMplugins { ... } block, that is extracted from the build script and investigated and evaluated separately, as the block present in the build script, not as result of a call with a closure.