https://kotlinlang.org logo
Title
b

BorzdeG

01/08/2020, 8:44 PM
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
doing based on an example: https://github.com/gradle/kotlin-dsl-samples/blob/master/samples/maven-publish/build.gradle.kts
o

octylFractal

01/08/2020, 8:45 PM
you need to import
org.gradle.kotlin.dsl.getValue
most likely
b

BorzdeG

01/08/2020, 8:53 PM
Thank happened