我试图将我的build.gradle文件迁移到buildSrc目录中的build.gradle.kts。请注意,在我的buildSrc中,我已经使用java-gradle-plugin和org.gradle.api中的api(例如Plugin,Project等)创建了gradle插件。但是当我配置脚本时,我的文件中有一个未解析的引用(使用org的人) .gradle.api
这是build.gradle文件的代码
plugins {
id 'java'
id 'java-gradle-plugin'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
}
gradlePlugin {
plugins {
netguard {
id = 'pluginId'
implementationClass = 'myplugin.plugin.awesomeplugin'
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
这是迁移的build.gradle.kts
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
java
`java-gradle-plugin`
id("org.jetbrains.kotlin.jvm") version "1.3.21"
}
gradlePlugin {
plugins {
create("netguard") {
id = "pluginId"
implementationClass = "myplugin.plugin.awesomeplugin"
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = "1.8"
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions.jvmTarget = "1.8"
这里是org.gradle.api中一些未解决的参考
org.gradle.api.Plugin
org.gradle.api.Project
org.gradle.api.file.ConfigurableFileTree
org.gradle.testing.jacoco.plugins.JacocoPluginExtension
org.gradle.testing.jacoco.tasks.JacocoCoverageVerification
org.gradle.testing.jacoco.tasks.JacocoReport
...
任何帮助将不胜感激。谢谢!