DevOps / Gradle8 Interview Questions
What are tasks in Gradle?
A task is the fundamental unit of work in a Gradle build — compiling source, running tests, copying files, packaging a jar. Every build script's real job is to define and wire together tasks, either directly or through plugins that register a standard set of them (like compileJava, test, and jar from the Java plugin).
tasks.register('hello') { doLast { println 'Hello from Gradle!' } }
Tasks can declare dependencies on other tasks (dependsOn), and Gradle assembles all requested tasks and their dependencies into a directed graph before running anything, so it can figure out the correct execution order and which tasks can safely run in parallel. Modern Gradle strongly favors the lazy tasks.register API shown above over the older, eager task syntax, since it avoids configuring tasks that end up not being needed for a given build invocation.
More Related questions...
