DevOps / Gradle8 Interview Questions
How do you run a specific task from the command line?
Passing the task name to gradle or the wrapper runs it, along with any tasks it depends on:
./gradlew test ./gradlew :core:build # run the build task only in the 'core' subproject ./gradlew build --parallel # run with parallel execution across independent tasks ./gradlew tasks # list all available tasks
In a multi-project build, prefixing the task with a project path (:core:test) scopes it to just that subproject, while running the bare task name (test) at the root triggers that task in every subproject that has it. Useful flags include --info/--debug for verbose diagnostic output, -x taskName to explicitly exclude a task from the run, and --dry-run to preview which tasks would execute without actually running them.
More Related questions...
