Kay Werndli
07/14/2024, 6:05 PMsubprojects { ... } is bad, but for a quick and dirty experiment, I hope I'm forgiven 😉). There are two ways that I see floating around: pluginManager.withPlugin and plugins.withType. Other than using different criteria to identify the applied plugin, are these two equivalent? It seems that they might be (if I understand the documentation correctly), but the fact that one method is associated with PluginManager and the other one with PluginContainer gives me pause. In addition, there is also plugins.withId, which, I guess, would then also be equivalent to pluginManager.withPlugin? If all of these are equivalent, is there a reason to prefer one over the other -- e.g. one being "the old way, which might get deprecated in the future"?Martin
07/14/2024, 6:08 PMpluginManager.withPlugin() to err on the safe side of things. I think this is the vetted wayMartin
07/14/2024, 6:09 PMsettings.gradle.kts :
// settings.gradle.kts
include("sub1")
include("sub2")
gradle.lifecycle.beforeProject {
apply(plugin = "base")
repositories {
mavenCentral()
}
}Martin
07/14/2024, 6:12 PMProject.plugins is soft deprecated. See Javadoc: https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/PluginAware.html#getPlugins()Martin
07/14/2024, 6:12 PMWhile not deprecated, it is preferred to use the methods of this interface or the plugin manager than use the plugin container.Kay Werndli
07/14/2024, 6:14 PMpluginManager.withPlugin is what I found in the official documentation as well. Thanks for pointing me to the soft deprecation Javadoc; I did see the plugins methods used by big Gradle contributors in some GitHub issues, and figured that one method might be newer.