import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.registering
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
class PublishPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = target.run {
apply<KotlinPluginWrapper>()
val sourcesJar by tasks.registering(Jar::class){
classifier = "sources"
}
}
}
Tell me what is wrong in the code? I get the error
Type 'RegisteringDomainObjectDelegateProviderWithTypeAndAction <out TaskContainer, Jar>' has no method 'getValue (Nothing ?, KProperty <*>)' and thus it cannot serve as a delegate