Hi @melix, i saw that you implemented this feature https://github.com/gradle/gradle/issues/15382
And that it’s merged. But i don’t understand how to use it, currently I’m working on a binary conventions plugin for my team. I created a version catalog in another plugin using the gradle version-catalog plugin, and i’m consuming it in the conventions plugin settings.gradle.kts like so:
Now i want to access it in my binary plugin code but i don’t have access to libs.something
Can you give any advice? or perhaps add a use example in the PR?
Thanks
j
Javier
12/24/2022, 4:42 PM
you need to use the unsafe api as the issue shows
i
Ido Flax
12/26/2022, 9:48 PM
@Javier I tried that, but I’m getting an error when applying the plug-in, saying the version catalog extension was not found
Can you provide a use example? The code snippet in the original issue ticket is not sufficient
j
Javier
12/26/2022, 10:13 PM
Copy code
the<VersionCatalogsExtension>()
That is working for me, not sure which Gradle version are you using
i
Ido Flax
01/11/2023, 7:16 PM
I got it now, thanks
Ido Flax
01/11/2023, 7:17 PM
for anyone interested:
Copy code
abstract class Conventions : Plugin<Project> {
protected var versionCatalog by Delegates.notNull<VersionCatalog>()
override fun apply(target: Project) {
with(target) {
versionCatalog = the<VersionCatalogsExtension>().find("versionCatalog").get()
...
private fun Project.configureJavaPlugin() {
extensions.configure(JavaPluginExtension::class.java) {
val java = versionCatalog.findVersion("java").get().displayName