@Lance … Any other build configuration can work using ‘project.with {}’.
I believe, PluginManagment is special and can’t be applied as you suggested.
I am getting below Error. Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method pluginManagement() for arguments [PluginClass$_apply_closure2$_closure5@4a55f617] on root project 'plugin-test' of type org.gradle.api.Project.
I could find ‘org.gradle.plugin.management.PluginManagementSpec’ from Gradle API which can do this… However, I could not find details on how to apply PluginMangementSpec to Gradle Project or Plugin.
Update:
I can able to add buildScript (old way) using
However, its failing while apply spring boot plugin due to below error .
Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'org.springframework.boot' not found.
at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:81)
I’m guessing that pluginManagement is an extension object which is added by the spring boot plugin so you’ll need to apply this first
org.gradle.api.plugins.UnknownPluginException: Plugin with id ‘org.springframework.boot’ not found
Your plugin is built by gradle and has its own dependencies. You’ll need to add spring boot as a dependency in the build.gradle for your plugin (possibly buildSrc/build.gradle)
Ah! That pluginManagement is for settings.gradle and not build.gradle. If you want to do this as a plugin you’ll need to implement Plugin<Settings> and apply the plugin in your settings.gradle instead of build.gradle