Gradle task check if property is defined

后端 未结 3 1024
醉梦人生
醉梦人生 2021-01-17 09:37

I have a gradle task that executes a testng test suite. I want to be able to pass a flag to the task in order to use a special testng xml suite file (or just use the default

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 09:48

    This worked for me:

    test {
        if (properties.containsKey('special')) {
            test(testng_special.xml);
        }
        else {
            test(testng_default.xml);
        }
    }
    

提交回复
热议问题