Slackbot
12/30/2023, 5:11 AMMike Wacker
12/30/2023, 5:27 AMbuildSrc/build.gradle.kts, but it's not available in the gradle.kts files for the convention plugins. Is an extra step needed for convention plugins?Mike Wacker
12/30/2023, 6:09 AMbuildSrc/build.gradle.kts, add this to the dependencies block: implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
2. In the conventions plugin, add these lines: import org.gradle.accessors.dm.LibrariesForLibs, val libs = the<LibrariesForLibs>()
3. In the conventions plugin, you can now reference, e.g., JUnit Jupiter via libs.junit.jupiter.
While this wasn't my original use case, it seems like you can (mostly) get it working for plugins, too:
1. In buildSrc/build.gradle.kts, use libs for any plugin dependencies (e.g., implementation(libs.plugin.spotless)).
2. In the conventions plugin, refer to the plugin by its id()--not via an alias() (e.g., id("com.diffplug.spotless")).
Honestly, that's good enough for me; id() vs alias() has no bearing on the version that's actually used.