Dylan
05/25/2020, 1:21 PMbuildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
}
}
repositories {
google()
jcenter()
}
dependencies {
implementation("com.squareup:kotlinpoet:1.5.0")
}
With that configuration, after trying to build my project, I have the following exception:
Caused by: org.gradle.api.plugins.InvalidPluginException: Could not find implementation class 'com.example.gradle.MyPlugin' for plugin 'MyPlugin' specified in [Path to buildSrc jar]
After looking into the Jar itself, it looks like MyPlugin.properties
is here, but not the class MyPlugin
.
Do you have any idea?gildor
05/25/2020, 1:26 PMDylan
05/25/2020, 1:27 PMgildor
05/25/2020, 1:30 PMDylan
05/25/2020, 1:38 PMapply plugin: 'java-gradle-plugin'
at the top of build.gradle of buildSrc, but I still face the same issue.apply plugin: 'kotlin'
?
But I now run into a new issue. All org.gradle.* classes are not recognized in my plugin.no
05/25/2020, 1:58 PMcompileOnly(gradleApi())
in your dependencies block?Dylan
05/25/2020, 1:59 PMJustin
05/25/2020, 3:25 PMDylan
05/25/2020, 3:36 PMapply plugin: 'java-gradle-plugin'
apply plugin: 'kotlin'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
}
}
repositories {
google()
jcenter()
}
dependencies {
implementation gradleApi()
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
implementation("com.squareup:kotlinpoet:1.5.0")
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
no
05/25/2020, 3:47 PMDylan
05/25/2020, 3:48 PMhttps://kotlinlang.slack.com/files/UP93BG1NF/F014XH1K9QQ/image.png▾
gildor
05/25/2020, 3:48 PMcompileOnly(gradleApi())
is not required if java-gradle-plugin appliedDylan
05/25/2020, 3:49 PMgildor
05/25/2020, 3:50 PMplugins {}
blockDylan
05/25/2020, 3:52 PMplugins {}
gildor
05/25/2020, 3:52 PMDylan
05/25/2020, 3:53 PMgildor
05/25/2020, 3:54 PMDylan
05/25/2020, 3:55 PM* What went wrong:
Plugin [id: 'kotlin'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plugin, please see <https://docs.gradle.org/5.6.4/userguide/standard_plugins.html> for available core plugins)
- Plugin Repositories (plugin dependency must include a version number for this source)
gildor
05/25/2020, 3:58 PMDylan
05/25/2020, 3:59 PMplugins {
id 'java-gradle-plugin'
id "org.jetbrains.kotlin.jvm" version "1.3.72"
}
repositories {
google()
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
implementation("com.squareup:kotlinpoet:1.5.0")
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
gildor
05/25/2020, 4:02 PMDylan
05/25/2020, 4:02 PMgildor
05/25/2020, 4:03 PMDylan
05/25/2020, 4:12 PMgildor
05/25/2020, 6:56 PMDylan
05/25/2020, 8:27 PMgildor
05/26/2020, 1:18 AMDylan
05/26/2020, 2:47 AMhttps://kotlinlang.slack.com/files/UP93BG1NF/F014XH1K9QQ/image.png▾
gildor
05/26/2020, 7:47 AMno
05/26/2020, 8:00 AMgildor
05/26/2020, 8:02 AMDylan
05/26/2020, 8:04 AMgildor
05/26/2020, 8:05 AMI tried with a Java file as welldoes it work?
Dylan
05/26/2020, 8:06 AMgildor
05/26/2020, 8:10 AMDylan
05/26/2020, 8:10 AMgildor
05/26/2020, 8:12 AMDylan
05/26/2020, 8:12 AMgildor
05/26/2020, 8:13 AMDylan
05/26/2020, 8:13 AMgildor
05/26/2020, 8:13 AMDylan
05/26/2020, 8:13 AMArun
05/26/2020, 9:44 AMgradle init
command which provides options to scaffold all the build scripts correctly.
Please refer here https://docs.gradle.org/current/userguide/build_init_plugin.htmlDylan
05/26/2020, 9:48 AMArun
05/26/2020, 9:51 AMbuildSrc
has poor separation of concerns since it is implicit. If you are looking for sample, I use composite builds for gradle plugins in one of my projects here.Dylan
05/26/2020, 9:53 AM