Bernhard Posselt
07/07/2026, 1:10 PMplugins {
`kotlin-dsl`
}
or something else entirely? What do I need to add in the build.gradle.kts file that makes use of that task?Vampire
07/07/2026, 1:23 PMkotlin-dsl would work, but would apply way too many unnecessary things.
If you anyway also use precompiled Kotlin DSL script plugins, then kotlin-dsl is anyway what you need so it would be fine.
...
And about where you use it, also depends, if you only have a task type, you either need to add a dependency in the buildscript { ... } block, or you can add a no-op plugin alongside your task and then apply that plugin in your build script just to get the classes onto the buildscript classpath.Bernhard Posselt
07/07/2026, 1:24 PMVampire
07/07/2026, 1:28 PMkotlin-dsl, or you can use plain K/JVM plugin, but if you do the latter, you also need to be aware that the sam-with-receiver plugin and the assignment plugin are not configured unless you do it yourself and so on.
If you did not have a build script in buildSrc, then applying kotlin-dsl should be the closest match afair.
If you do have a build script in buildSrc, you probably need the same or similar in your build-logic.Bernhard Posselt
07/07/2026, 1:32 PMBernhard Posselt
07/07/2026, 1:33 PMbuildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("<http://com.my:task:1.0.0|com.my:task:1.0.0>")
}
}Thomas Broyer
07/07/2026, 1:38 PMBernhard Posselt
07/07/2026, 1:38 PMBernhard Posselt
07/07/2026, 1:39 PMBernhard Posselt
07/07/2026, 1:39 PMVampire
07/07/2026, 2:14 PMI do need to create an artifact version and group for the build-logic folder, correct?Actually, no. If it is coming from an included build, the version you declare is ignored anyway, so you can leave it out. And if you don't define a group, it is empty. So you can depend on
":build-logic" which will work, as it has an empty group and no version.
In that form it just looks like a project dependency but is actually a GAV dependency.
and then add something like this in the build.gradle.kts where I want to make use of the taskIf you don't have some plugin you also apply, or added it to a higher classpath already, then yes.
Bernhard Posselt
07/07/2026, 2:18 PM