I threw this together really quick: https://github.com/foip/jib-convention-test .
The crux is adding the jib plugin and the extension to buildSrc/build.gradle.kts.
I don't know if this matches your project setup, so let me know if this does or doesn't work for you (:
Edit:
To put the answer to the original question in more general terms for anyone who stumbles upon this thread:
In this case the jib-gradle-plugin is applied as a plugin in the root build.gradle.kts, but it needs extra runtime dependencies for its extensions. You normally would declare those dependencies like so:
// in root build.gradle.kts
buildscript {
dependencies {
classpath(/* dependency */)
}
}
When you want to write a convention plugin to wrap that configuration, basically everything that went inside that buildscript block now goes into buildSrc/build.gradle.kts:
// in buildSrc/build.gradle.kts
repositories {
mavenCentral()
}
dependencies {
implementation(/* dependency */)
}
That goes for other dependencies as well, for example if you want to use a library to write a custom task, and then you refactor that task into a plugin inbuildSrc.