Johann Pardanaud
06/07/2023, 10:43 PMbuildSrc
? I've created a simple build with the following structure:
• project lib
• project app
(depends on lib
)
both projects will be written in Kotlin, so I wanted to create a plugin script to group some common configuration, here is the content of `buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts`:
plugins {
kotlin("jvm")
}
but, when I run it, I get the following error:
Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
and if I try to set a version with kotlin("jvm") version "1.8.10"
, I get:
Invalid plugin request [id: 'org.jetbrains.kotlin.jvm', version: '1.8.10']. Plugin requests from precompiled scripts must not include a version number. Please remove the version from the offending request and make sure the module containing the requested plugin 'org.jetbrains.kotlin.jvm' is an implementation dependency of project ':buildSrc'.
Here is a reproducible example, you just have to download the zip file and run ./gradlew
Adam S
06/07/2023, 10:44 PMbuildSrc/build.gradle.kts
I find the easiest way is to find the plugin in the Gradle Plugin Portal, and look at the ‘legacy’ method. It will have classpath(<maven-coordinates>)
. Use those coordinates as the dependency, like so:
// buildSrc/build.gradle.kts
plugins {
`kotlin-dsl`
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
ephemient
06/07/2023, 10:50 PMJohann Pardanaud
06/08/2023, 8:44 AMVampire
06/08/2023, 12:03 PM<pluginid>:<pluginid>.gradle.plugin:<pluginversion>
?