This message was deleted.
# community-support
s
This message was deleted.
m
It looks like the version catalog is available in
buildSrc/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?
Ugh, this is https://github.com/gradle/gradle/issues/15383 But from what I'm reading there (this is @Vampire’s workaround), this appears to work for me: 1. In
buildSrc/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.
šŸ‘Œ 1