DevOps / Gradle8 Interview Questions
How do you apply a plugin in Gradle?
The modern, recommended way is the plugins {} block at the top of a build script, referencing the plugin by its ID:
plugins { id 'java' id 'org.springframework.boot' version '3.3.0' }
Core plugins (like java) need no version since they ship with Gradle itself; community plugins from the Plugin Portal need an explicit version. An older, still-supported alternative is apply plugin: 'java' using the legacy syntax, but the plugins {} block is preferred because it lets Gradle validate and resolve plugin versions upfront, before the rest of the script runs, and it supports better IDE tooling and version-conflict detection than the legacy form.
For plugins meant to be shared across a project's own subprojects (rather than pulled from the Plugin Portal), a precompiled script plugin in buildSrc or an included build lets internal conventions be applied the same id '...' way as any external plugin.
More Related questions...
