Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent gradle build from executing test task

Tags:

gradle

I know that I can use the -x test option to prevent the test task from getting called. I also have something like this in my gradle script to prevent tests from being executed in certain cases:

plugins.withType(JavaPlugin).whenPluginAdded {
    test {
        doFirst {
            if (env.equals('prod')) {
                throw new StopExecutionException("DON'T RUN TESTS IN PROD!!!!")
            }
        }
    }
}

but is there a way to configure the java plugin to removed the dependency between build -> test?

like image 564
bmurmistro Avatar asked Dec 05 '13 20:12

bmurmistro


2 Answers

build depends on test via check. You probably don't want to remove the dependency on check as it may do other things, so you could try:

check.dependsOn.remove(test)

Do you mind if I ask why you want to do this?

like image 112
Perryn Fowler Avatar answered Sep 21 '22 05:09

Perryn Fowler


You can skip tasks via the command line with the -x option:

./gradlew assembleDebug -x taskToSkip
like image 40
Cristan Avatar answered Sep 21 '22 05:09

Cristan