1

I'm trying to apply a plugin from a shared gradle script.

in my shared gradle script I have the following code:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
    }
}
apply plugin: "org.jetbrains.kotlin.jvm"

In the other builds I try and do

apply from: "shared.gradle"
...

If I run any gradle task, I get the following error:

 Plugin with id 'org.jetbrains.kotlin.jvm' not found

I've tried multiple ids instead of "org.jetbrains.kotlin.jvm": like "org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper" and "kotlin"... none works!

What am I doing wrong??

caeus
  • 3,084
  • 1
  • 22
  • 36

2 Answers2

1

I had the same issue today, what fixed it for me was adding this on buildSrc/build.gradle.kts

dependencies {
  implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.10")
}

And then, on my conventions script buildScr/src/main/kotlin/application-conventions.gradle.kts I just removed the version

plugins {
    id("org.jetbrains.kotlin.jvm")
}
petrubear
  • 616
  • 5
  • 6
  • You can also use `kotlin("jvm")` in your conventions script instead of `id("org.jetbrains.kotlin.jvm")` to keep it kotlin friendly. – Valdèse Kamdem Oct 12 '22 at 03:49
0

The classpath for kotlin Plugin is org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper

Mox
  • 2,355
  • 2
  • 26
  • 42