Gradle build without tests

后端 未结 13 1573
后悔当初
后悔当初 2020-12-12 08:41

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

$ gradle -Dskip.tests build

That doesn\'t seem to

13条回答
  •  我在风中等你
    2020-12-12 09:35

    Every action in gradle is a task, and so is test. And to exclude a task from gradle run, you can use the option --exclude-task or it's shorthand -x followed by the task name which needs to be excluded. Example:

    gradle build -x test
    

    The -x option should be repeated for all the tasks that needs to be excluded.

    If you have different tasks for different type of tests in your build.gradle file, then you need to skip all those tasks that executes test. Say you have a task test which executes unit-tests and a task testFunctional which executes functional-tests. In this case, you can exclude all tests like below:

    gradle build -x test -x testFunctional
    

提交回复
热议问题