Hey I was wondering if it was possible to have a c...
# gradle
t
Hey I was wondering if it was possible to have a custom version in the
plugins
section.
Copy code
val test_version: String by project
plugins {
  id("random.plugin") version "$test_version"
}
I want to just have a single value to update that will update the version of a plugin in my entire project. The current error being thrown is
'val test_version: String' can't be called in this context by implicit receiver. Use the explicit one if necessary
e
no, the
plugins
block (and a couple others, such as
buildscript
) are executed independently of the rest of the build script
those blocks affect the classpath so there's a chicken-and-egg problem otherwise
t
Ah gotcha. I'm running a monorepo setup so just being able to modify plugin versions like that would've been useful
e
why not use version catalogs? that is officially supported
t
Oh never heard of that, I'll look into it
Oh this looks much better, thank you
v
And before that was the
pluginManagement { plugins { ... } }
block which does exactly what you want too, defining a version that is used if a plugin is applied without version. But yeah nowadays I'd also recommend version catalogs
t
Yeah I've already implemented it with version catalogs, seems to be working fine. Thank you everyone
👌 2
👌🏾 1