How can I not include a build task when I include a project in my settings.gradle file?

↘锁芯ラ 提交于 2019-12-06 11:25:05

Well this question has been asked in different ways , the main theme of the question is;

How to exclude sub tasks of build task?

1 . gradle build -x test

The above instruction is helpful while executing gradle build command from CLI; this exludes test task, but we want to exclude test task programmatically in build.gradle file. Look below the answer for the respective question.

2 . check.dependsOn -= test

Copy this small script in your build.gradle file. Now when you execute gradle build from CLI, your tests won't run at all.

Cheers !

You could try to disable the task only if a build task is present... Something like:

project(":serverTest").test.onlyIf { !gradle.taskGraph.hasTask(":shared:build") }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!