Skip to main content

How to Build Gradle Without(skip) Test

  • We learned how to build a Gradle-based project without running tests.
    • When you run the gradle build command, tests are run by default, but if you want to build without running tests, you can run the command as follows.
  • Basically, it is advisable to build with all tests passing, but there are cases where it is necessary to build without running tests.
  • At this time, you can build without running tests by using the --exclude-task test option.
gradle build --exclude-task test
  • Another way is to add the settings to the build.gradle file as follows.
test {
enabled = false
}
  • If you add the settings as above, you can build without running tests when executing the gradle build command.
  • You can build without all tests by adding the settings as shown below.
test {
exclude '**/*'
}