--exclude-task does not work with multiple dependent tasks


I want to exclude a task from execution. To do this i use --exclude-task/-x on the command line. However when I give more than one task on the command line, that depends on the excluded task, the task is executed anyway.

A short build script to reproduce this is:

task level0
    task level1 (dependsOn:level0)
        task level2a (dependsOn:level1)
        task level2b (dependsOn:level1)

What I want to do is exclude task level1.

Giving just one task on the command line:

gradle level2a -x level1

executes just level2a as expected.

However adding another dependent to the command line like this:

gradle level2a level2b -x level1

executes level2a, level2b and level1.

I think building task level1 is an error.

Task level0 is never build.

I tested this with gradle 1.9 and 1.10-rc-1.


------------------------------------------------------------ Gradle 1.10-rc-1 ------------------------------------------------------------ Build time:

2013-12-04 15:41:28 UTC Build number: none Revision:



1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_45 (Oracle Corporation 24.45-b08) OS:

Linux 2.6.32-5-amd64 amd64

Thanks for the report. This appears to be a regression introduced in 1.7. Filed GRADLE-2974.

Fixed in 1.12.

When is version 1.12 planned for release…