Run Gradle While Excluding Tests
Explains how to run Gradle while excluding tests.
There are times when you want to run a Gradle command while excluding the test task.
Excluding with a Command Option
The following command runs the build task while excluding the test task.
$ gradle build --exclude-task test
You can also shorten the option as follows.
$ gradle build -x test
Excluding in the Configuration File
You can also write the following in the build.gradle file to exclude tests by package.
The file range can be configured with a wildcard (*).
Use the following format.
test {
exclude '**/*'
}
test {
exclude 'com/example/demo**'
}