Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build without tests

Tags:

java

gradle

I want to execute gradle build without executing the unit tests. I tried:

$ gradle -Dskip.tests build 

That doesn't seem to do anything. Is there some other command I could use?

like image 834
Dave Avatar asked Jan 04 '11 20:01

Dave


People also ask

How do I skip a test in build Gradle?

To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build.

Does Gradle build run tests?

By default, Gradle will run all tests that it detects, which it does by inspecting the compiled test classes. This detection uses different criteria depending on the test framework used. For JUnit, Gradle scans for both JUnit 3 and 4 test classes.

How do I skip a test in Gradle build IntelliJ?

To skip unit tests from gradle build you can use the -x or --exclude-task option. By using -x option you can skip or ignore any gradle task as well. Following example command to run gradle build without tests.

What is test in Gradle build?

Advertisements. The test task automatically detects and executes all the unit tests in the test source set., Once the test execution is complete, it also generates a report. JUnit and TestNG are the supported APIs. The test task provides a Test.


1 Answers

You should use the -x command line argument which excludes any task.

Try:

gradle build -x test  

Update:

The link in Peter's comment changed. Here is the diagram from the Gradle user's guide

like image 50
c_maker Avatar answered Oct 01 '22 08:10

c_maker