Scrivio Interview library

Gradle

27 questions in 9 subtopics.

Tasks and the build lifecycle

ConceptFoundations6 min read
Describe Gradle's initialization, configuration and execution phases. Why is doing work like reading files or calling the network at configuration time a problem?
CodingFoundations6 min read
What is the difference between tasks.register("x") and tasks.create("x") in Gradle, and why does it matter for large builds?
InternalsIntermediate8 min read
How does Gradle decide that a task is UP-TO-DATE, and what mistakes in custom tasks cause it to rerun every time or, worse, to skip when it should run?
ScenarioPrincipal6 min read
Ten years from now your build scripts will be maintained by people who did not write them. What principles would you set for Gradle build code today?

Configurations

ConceptFoundations5 min read
In a Gradle Java library, what is the difference between api, implementation, compileOnly and runtimeOnly configurations?
DebuggingIntermediate7 min read
Gradle resolves jackson-databind to 2.17 but a module was tested with 2.15 and a library needs 2.18. Explain Gradle's default conflict resolution and the tools to control and inspect it.
DesignAdvanced7 min read
Your internal library is consumed by 80 Gradle services. Explain how you decide what goes into api versus implementation, and how you prevent the library from forcing versions onto consumers.

Kotlin DSL

ConceptFoundations7 min read
Why have many teams moved Gradle builds from Groovy DSL to Kotlin DSL, and what are the costs?
CodingIntermediate7 min read
Show how you would replace a 'subprojects { ... }' block that configures Java version, test settings and Checkstyle for all modules with a Kotlin DSL convention plugin.

Build cache and incremental builds

ConceptFoundations6 min read
What is the difference between Gradle incremental builds (UP-TO-DATE) and the build cache (FROM-CACHE)?
DebuggingIntermediate7 min read
Your team set up a remote Gradle build cache but CI hit rates stay below 20 percent. What causes cache misses and how do you investigate?
LeadershipAdvanced6 min read
Build time across your 300-engineer Java organisation is a growing complaint. How would you justify and roll out remote build caching and other build performance investments?
LeadershipPrincipal6 min read
Over five years, build infrastructure (remote cache, build scans, CI agents) can cost as much as a small product team. How would you decide how much to invest in Gradle build performance, and how would you keep the investment from decaying?

Version catalogs

CodingFoundations6 min read
What does a Gradle version catalog look like and how is it used from a build script?
ConceptIntermediate6 min read
A team asks whether a version catalog replaces the Spring Boot BOM. Explain the difference between a version catalog and a platform.
DesignAdvanced6 min read
You want 60 Gradle repositories to share dependency versions and build conventions. Compare publishing a shared version catalog, a platform, and a set of convention plugins, and propose a combination.

Multi-project builds

ConceptFoundations6 min read
How does a Gradle multi-project build work: what does settings.gradle.kts do, and how does one subproject depend on another?
DesignIntermediate5 min read
When would you use a Gradle composite build (includeBuild) instead of adding projects to one multi-project build?
LeadershipPrincipal6 min read
Your company standardised on Maven a decade ago; several teams now want Gradle. How do you decide whether to allow two build tools, migrate, or keep one?

Migrating from Maven

ScenarioFoundations7 min read
You need to migrate a single-module Maven project with Spring Boot, a few plugins and a parent POM to Gradle. What steps would you take and what usually goes wrong?
ScenarioIntermediate7 min read
A 40-module Maven build takes 25 minutes and the team wants Gradle for the build cache. How would you plan and de-risk the migration?
LeadershipAdvanced6 min read
Half of your 200 repositories use Maven and half use Gradle, and the platform team maintains duplicate tooling for both. Would you mandate one build tool, and how would you decide?

Gradle versions and upgrades

ConceptFoundations7 min read
What is the Gradle wrapper, why should every project use it, and how do you upgrade Gradle safely?
DebuggingIntermediate7 min read
After upgrading Gradle by one major version, the build fails with errors about removed APIs in a third-party plugin and the configuration cache reports many problems. How do you get the upgrade done?
LeadershipAdvanced7 min read
Your organisation has 150 Gradle builds on versions spread over four major releases, and some builds cannot run on the current JDK. How would you set and enforce an upgrade policy?

Gradle setup and IDE integration

ConceptFoundations6 min read
How do IntelliJ IDEA and Eclipse integrate with a Gradle build, and what are Java toolchains for?
ScenarioIntermediate8 min read
New developers need half a day to get a large Gradle project building in their IDE: wrong JDK, missing credentials for the private repository, and slow imports. How do you improve the setup?