Gradle build without tests

Try:

gradle assemble

To list all available tasks for your project, try:

gradle tasks

UPDATE:

This may not seem the most correct answer at first, but read carefully gradle tasks output or docs.

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.

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


You can add the following lines to build.gradle, **/* excludes all the tests.

test {
    exclude '**/*'
}

The accepted answer is the correct one.

OTOH, the way I previously solved this was to add the following to all projects:

test.onlyIf { ! Boolean.getBoolean('skip.tests') }

Run the build with -Dskip.tests=true and all test tasks will be skipped.

Tags:

Gradle