How can I externalize this ```plugins { id 'com...
# gradle
u
How can I externalize this
Copy code
plugins {
  id 'com.squareup.anvil' version "${latest_version}"
}
to something like
Copy code
plugins {
   ext.plugins.anvil
}
v
Better don't use
ext
for anything, it is almost just a crutch with better alternatives. If I understood correctly what you want is to define the version in one place and then use the plugin in multiple build scripts without specifying the version, right?
Then just use
pluginManagement {  plugin { ... } }
in the settings script to declare the default version to use for the plugin and then in the build scripts just use the plugin without version.
Alternatively you could declare a convention plugin in
buildSrc
or an included build and there apply the plugin, then in your build script you simply apply your convention plugin which can also do more things like common configuration.
u
yes, I wasnt aware of the pluginManagement closure; im migrating from the old "apply", thanks!