I have created DefaultTask inside my buildSrc
-buildSrc
-src
-main/java/work.FilePrefTask.kt
-build.gradle.kts
FilePrefTask view
abstract class FilePrefTask: DefaultTask() {
@TaskAction
fun action(){
println("Hello world")
}
build.gradle.kts
repositories {
mavenCentral()
}
plugins {
`kotlin-dsl`
}
tasks.register<FilePrefTask>("prefTask",FilePrefTask::class){
}
}
But when I try make async I get exceptions
\buildSrc\build.gradle.kts:9:16: Unresolved reference: FilePrefTask
\buildSrc\build.gradle.kts:9:61: Passing value as a vararg is only allowed inside a parenthesized argument list
Script compilation errors:
I tried add import after had moved in other packet my DefaultTask but without success
And nothing else. What i did incorrect?
CodePudding user response:
buildSrc/build.gradle.kts
is the build script of your custom task or script templates under buildSrc/src
. You should apply the task in app/build.gradle.kts
instead.