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的更多相关文章

  1. 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 ...

  2. 打包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 ...

  3. Gradle Goodness: Task Output Annotations Create Directory Automatically

    Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...

  4. 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. ...

  5. 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 ...

  6. 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 ...

  7. Gradle Goodness: Copy Files with Filtering

    Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. [转]Tips——Chrome DevTools - 25 Tips and Tricks

    Chrome DevTools - 25 Tips and Tricks 原文地址:https://www.keycdn.com/blog/chrome-devtools 如何打开? 1.从浏览器菜单 ...

  2. BZOJ1053 [HAOI2007]反素数 & BZOJ3085 反质数加强版SAPGAP

    BZOJ 1053 Description 对于任何正整数x,其约数的个数记作g(x).例如g(1)=1.g(6)=4.如果某个正整数x满足:g(x)>g(i) 0<i<x ,则称x ...

  3. 理解webpack4.splitChunks之其余要点

    splitChunks除了之前文章提到的规则外,还有一些要点或是叫疑惑因为没有找到官方文档的明确说明,所以是通过我自己测试总结出来的,只代表我自己的测试结果,不一定正确. splitChunks.ca ...

  4. ThreeJS geometry的顶点世界坐标

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. axios中设置post请求,后台却无法识别参数

    场景:在使用iview时,定义api请求时,代码如下 export const delWord = (data) => { return axios.request({ url: '/words ...

  6. Raspberry install wine

    sudo apt install wine winecfg出现问题 树莓派3B是卡片电脑,内存为1GB,一般运行Linux.Linux两种主流的内存分配方法2G/2G和3G/1G,树莓派系统后期优化性 ...

  7. RoCE、softRoCE与iWRAP

    RoCE - RDMA over Converged Ethernet 以太网在全球互联的广域网中毫无异议的老大,但在高带宽.低延时的专有网络领域却明显混不开.伴随网络融合概念兴起,IETF发布了DC ...

  8. C# 元素组合算法

    class Program { static void Main(string[] args) { string[] a = { "A", "B", " ...

  9. Git分布式工作流程

    Git官网给出了三种分布式工作流程: 集中式工作流程 集成管理者工作流 司令官与副官工作流 这里以私有gitserver服务器上的git-test项目为例,简单说明集中式工作流程. 基于分支的开发策略 ...

  10. php自动载方法有两种.

    但有一问题没有解决, 就是在include前判断文件是否存在的问题. 1 2 3 4 5 6 7 8 9 10 11 12 13 set_include_path('aa' . PATH_SEPARA ...