Skip to content
Sharp

Build Tools · interview question

In Gradle, how can you configure a task to execute only if another task has been executed without failure?

Multiple choiceHardchapter-10-curatedpremiumbuild-toolsbuild-lifecycle
Choose one answer
Answer and explanation

Correct answer

D. Use onlyIf predicate

Why

The 'onlyIf' predicate in Gradle allows you to specify conditions under which a task should execute. It ensures that a task only runs if a specified condition is met, such as the successful completion of another task.

Test yourself on Build Tools

A free test with instant, explained results. No account needed.

Start free test
All Build Tools questions →