(I asked this question on StackOverflow (What's the difference between `plugins {}` and `pluginManagement.plugins {}` in `settings.gradle` - Stack Overflow) but received no response, so I’m asking it here now. Thank you in advance)
Basically the title.
I couldn’t find a simple comparison anywhere, explaining the differences between these two:
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
plugins {
id "com.some.awesomeplugin" version "1.2.3"
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}
}
// And these:
plugins {
id "com.another.greatplugin" version "2.1.37"
id "com.android.application" version "7.3.0" apply false
}
I’m aware that there can be 3 types of plugins in Gradle:
- Project plugins, whose
apply()
callback is called when the individualbuild.gradle
files are evaluated:
class BuildPhasePlugin : Plugin<Project>
- Settings plugins, whose
apply()
callback is called when thesettings.gradle
file is evaluated:
class SettingsPhasePlugin : Plugins<Settings>
- Initialization plugins, whose
apply()
is called when initialization script (init.gradle
) is evaluated:
class InitPhasePlugin : Plugin<Gradle>
I suppose these 3 types of plugin are somehow related to the plugins {}
block they can be applied in in settings.gradle
?