DevOps / Gradle8 Interview Questions
What are dependency configurations in Gradle?
A configuration is a named set of dependencies with a specific purpose and visibility — it controls not just what's on the classpath, but when and to whom that dependency is exposed. The Java plugin defines several standard ones:
| Configuration | Meaning |
| implementation | Available at compile and runtime, but hidden from consumers of this project as a dependency. |
| api | Available at compile and runtime, AND exposed to consumers (requires the java-library plugin). |
| compileOnly | Available only at compile time, not packaged or available at runtime. |
| runtimeOnly | Available only at runtime, not needed to compile. |
| testImplementation | Available only for compiling and running tests. |
Choosing the right configuration isn't just style — using api where implementation would do leaks a dependency into every downstream consumer's compile classpath unnecessarily, which slows builds and can cause version conflicts elsewhere in a larger project.
More Related questions...
