Is it possible to somehow not fulfill the dependencies of a task when this task is skipped?
In the example below, I would like the jar (and jar dependencies) not to execute if the server is already running while running runServerTests . In this case, the server will be started by another process.
apply plugin: 'java' task startServerIfNotRunning(dependsOn: jar) { onlyIf { isServerNotRunning() } ... } task runServerTests(dependsOn: startServerIfNotRunning) { ... }
I do not want to add onlyIf to the jar task, since other tasks that should always be performed may depend on this. The jar task also has its own dependencies.
source share