DevOps / Gradle8 Interview Questions
Which is better and why: buildSrc or an included build for build logic?
Both let you write custom build logic (convention plugins, shared tasks) as real, compiled code instead of copy-pasted script snippets, but they differ in one big practical way: buildSrc is automatically included and rebuilt on every single build invocation, and any change inside it invalidates the whole build's configuration cache, whereas a properly declared included build (via includeBuild) is only rebuilt when something actually depends on it, and doesn't force a full rebuild for unrelated changes.
For a small project with modest shared build logic, buildSrc's simplicity (just a folder, no extra settings.gradle wiring) is often good enough and easier to set up. For larger projects, or when the same build logic needs to be shared and versioned across multiple, separate Gradle builds (not just subprojects of one build), an included build is the better and more scalable choice — it behaves like a real, independent Gradle project that happens to be substituted in, avoids the "always rebuilt" cost, and can be published or reused elsewhere.
The practical rule: start with buildSrc for a single project's internal conventions; move to an included build once that logic needs to be shared across multiple builds or the always-rebuild cost of buildSrc becomes noticeable.
More Related questions...
