Trying to make a plugin and publish it to local repo
directory.
Plugin ./build.gradle.kts
plugins {
kotlin("jvm") version "1.3.71"
id("java-gradle-plugin")
`maven-publish`
}
group = "com.abc"
version = "1.0.0"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
gradlePlugin {
plugins {
create("playground") {
id = "playground"
implementationClass = "com.abc.PlaygroundPlugin"
}
}
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
publishing {
repositories {
maven {
url = uri("./repo")
}
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["kotlin"])
artifact(sourcesJar.get())
}
}
}
And trying to use it ./demo/build.gradle.kts
:
buildscript {
repositories {
maven {
url = uri("../repo")
}
}
dependencies {
classpath("com.abc:playground:1.0.0")
}
}
plugins {
kotlin("jvm") version "1.3.71"
id("playground") version "1.0.0"
}
group = "com.abc.demo"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
The plugin is located correctly. But add it to plugins
failes:
Plugin [id: 'playground', version: '1.0.0'] was not found in any of the following sources
Do I miss something?