Gradle build without tests

后端 未结 13 1562
后悔当初
后悔当初 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:24

    the different way to disable test tasks in the project is:

    tasks.withType(Test) {enabled = false}
    

    this behavior needed sometimes if you want to disable tests in one of a project(or the group of projects).

    This way working for the all kind of test task, not just a java 'tests'. Also, this way is safe. Here's what I mean let's say: you have a set of projects in different languages: if we try to add this kind of record in main build.gradle:

     subprojects{
     .......
     tests.enabled=false
     .......
    }
    

    we will fail in a project when if we have no task called tests

提交回复
热议问题