Gradle compile tests but not run them

I would like to run a Gradle build that compiles tests (JUnit tests in a directory src/test/java

) but doesn't run them.

./gradlew build

compiles and runs tests, ./gradlew build -x test

not compiles tests. I've also tried ./gradlew build -x testClasses

, but it's not good - it builds and runs tests.

Is there a way to achieve this?

+3


source to share


1 answer


gradle build testClasses -x test

      

build

-task is basically a tag test

(depends on check

-task) and assemble

-task

So if you exclude test

there is no need to create testClasses, so you need to add them manually.



Note. If you don't want the tests to run, you can also use tasks assemble

.

gradle assemble testClasses

      

+4


source







All Articles