Gradle Goodness: Excluding Tasks for Execution
In Gradle we can create dependencies between tasks. But we can also exclude certain tasks from those dependencies. We use the command-line option -x or --exclude-task and specify the name of task we don't want to execute. Any dependencies of this task are also excluded from execution. Unless another task depends on the same task and is executed. Let's see how this works with an example:
00.
task copySources << {
01.
println
'Copy sources.'
02.
}
03.
04.
task copyResources(dependsOn: copySources) << {
05.
println
'Copy resources.'
06.
}
07.
08.
task jar(dependsOn: [copySources, copyResources]) << {
09.
println
'Create JAR.'
10.
}
11.
12.
task deploy(dependsOn: [copySources, jar]) << {
13.
println
'Deploy it.'
14.
}
We execute the deploy task:
$ gradle -q deploy
Copy sources.
Copy resources.
Create JAR.
Deploy it.
Now we exclude the jar task. Notice how the copySources task is still executed because of the dependency in the deploy task:
$ gradle -q deploy -x jar
Copy sources.
Deploy it.
Gradle Goodness: Excluding Tasks for Execution的更多相关文章
- Gradle Goodness: Adding Tasks to a Predefined Group
In Gradle we can group related tasks using the group property of a task. We provide the name of our ...
- 打包APK出现org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
AndroidS Studio打包APK时出现问题:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':a ...
- Gradle Goodness: Task Output Annotations Create Directory Automatically
Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...
- Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects
Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects Gradle is very flexible. ...
- org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
转载请注明出处:http://www.cnblogs.com/cnwutianhao/p/6709758.html Android Studio导入项目报错: org.gradle.api.inter ...
- Android studio Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to
http://blog.csdn.net/FlyRabbit_1/article/details/74536317 Error:org.gradle.api.internal.tasks.Defaul ...
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
- Gradle Goodness: Continue Build Even with Failed Tasks
If we run a Gradle build and one of the tasks fails, the whole build stops immediately. So we have f ...
- Gradle Goodness: Group Similar Tasks
In Gradle we can assign a task to a group. Gradle uses the group for example in the output of $ grad ...
随机推荐
- python中字典,没键加键,有键操作其键对应的值,的思想
cars = ['鲁A32444', '鲁B12333', '京B8989M', '黑C49678', '黑C46555', '沪B25041', '黑C34567'] locations = {'沪 ...
- python中类变量和实例变量
1. 类变量和实例变量 在Python Tutorial中对于类变量和实例变量是这样描述的: Generally speaking, instance variables are for data u ...
- mac关闭渐隐和弹出动画效果
苹果系统应用程序的窗口和对话框每次使用的时候都有华丽的特效,但是如果你感觉这种特效显得有点慢(MacGG闲的蛋疼),那该如何取消掉他呢? 方法很简单,打开"终端"(Finder-& ...
- jpa dialect设置
1.如果配置文件格式为application.properties,在配置文件中添加以下代码即可: spring.jpa.database-platform=org.hibernate.dialect ...
- [翻译] ZLSwipeableView
ZLSwipeableView A simple view for building card like interface like Tinder and Potluck. ZLSwipeableV ...
- 天池精准医疗大赛——人工智能辅助糖尿病遗传风险预测
作为天池上的新手,第一次参加天池阿里云线上的比赛,糖尿病预测, 一般的数据挖掘比赛,流程:数据清洗,特征工程(找特征,特征组合),不断的尝试的不同算法,不断调参,也可以考虑将多个模型进行线性组合 大赛 ...
- [C++]auto_ptr绑定到指针
接受指针的构造函数为explicit构造函数,所以必须使用初始化的直接形式来创建auto_ptr对象: auto_ptr<int> pi = new int(1024);//error a ...
- SVG中的元素属性
SVG attributes by category Animation event attributes onbegin, onend, onload, onrepeat Animation att ...
- less使用总结
15年自学了 less ,可是一直没用,就忘记了.后来抱着提高 css 开发速度的目的,又去学习了 less ,学完马上用,效果立竿见影,记得也牢了.刚开始学习前,我们总会问自己一个问题,学习它有什么 ...
- 搭建 PhoneGap 开发环境
一.JDK 下载以及安装.配置 参考:http://www.cnblogs.com/LO-ME/p/3530345.html 二.Android开发环境的搭建 参考:http://www.cnblog ...