We can run a Gradle build without any of the task actions being executed. This is a so-called dry run of our build. We can use the dry run of a build to see if the task dependencies we have defined or are defined in a plugin are defined properly. Because all tasks and task dependencies are resolved if we use the dry run mode we can see in the output which tasks are executed.

We define a simple build file with three tasks and some task dependencies:

0.def printTaskNameAction = {
1.println "Running ${it.name}"
2.}
3. 
4.task first << printTaskNameAction
5. 
6.task second(dependsOn: first) << printTaskNameAction
7. 
8.task third(dependsOn: [first, second]) << printTaskNameAction

To run a Gradle build as a dry run we can use the command line option -m or --dry-run. So let's execute the task third with the dry run command line option:

$ gradle -m third
:first SKIPPED
:second SKIPPED
:third SKIPPED
 
BUILD SUCCESSFUL
 
Total time: 2.242 secs
$

And we see in the output none of the tasks are really executed, because SKIPPED is shown, but we do see the task names of the tasks that are resolved.

Written with Gradle 2.2.

Gradle Goodness: Check Task Dependencies With a Dry Run的更多相关文章

  1. Gradle Goodness: Skip Building Project Dependencies

    If we use Gradle in a multi-module project we can define project dependencies between modules. Gradl ...

  2. Gradle Goodness: Working with Live Task Collection

    Gradle support the definition of so called live collections. These collections are mostly created ba ...

  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: Excluding Tasks for Execution

    In Gradle we can create dependencies between tasks. But we can also exclude certain tasks from those ...

  5. Gradle Goodness: Copy Files with Filtering

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

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

  7. Gradle Goodness: Using and Working with Gradle Version

    To get the current Gradle version we can use the gradleVersion property of the Gradle object. This r ...

  8. Gradle Goodness: Automatic Clean Tasks

    Gradle adds the task rule clean<Taskname> to our projects when we apply the base plugin. This ...

  9. Gradle Goodness: Changing Name of Default Build File

    Gradle uses the name build.gradle as the default name for a build file. If we write our build code i ...

随机推荐

  1. SZU3

    CodeForces 343A 这是第一题,像这种水题一定不要想复杂,思路不对立马换. 抓住串联和并联,可以用辗转相除法 #include <iostream> #include < ...

  2. JavaScript常用类

    JS常用类 一.Number 1.常用数字 整数:10 小数:3.14 科学计数法:1e5 | 1e-5 正负无穷:Infinity | -Infinity 2.常用进制 二进制:0b1010 八进制 ...

  3. gulpfile配置

    /** * 只包含合并压缩混淆,监听服务 */// 引入gulp模块var gulp = require('gulp'); // 引入其他模块var less = require('gulp-less ...

  4. response.setHeader()下载的用法

    1. HTTP消息头 (1)通用信息头 即能用于请求消息中,也能用于响应信息中,但与被传输的实体内容没有关系的信息头,如Data,Pragma 主要: Cache-Control , Connecti ...

  5. MFC string char cstring 类型转换

    在Unicode环境下用以下转换: CString z_strCurtTime = _T(""); // 获取当前时间 CTime z_tCurTime = CTime::GetC ...

  6. Mysql 启动失败常见错误

    各位可以按照顺序逐条拍错. mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file (/opt/my ...

  7. 十大创客与微软智能云Azure

    由微软举办的“2016年创客先锋—基于微软智能云Azure 的 SaaS 应用软件大赛”已于本周二在中关村圆满落幕.来自全国22家孵化园的创客,历时两个月,开发出百余项基于微软智能云Azure开发的创 ...

  8. SQLSERVER procedure 传入参数为DataTable类型 C#该怎么写

    以上为数据库中存储过程传入参数为table类型 table类型在数据库中存在为: 最后在C#实现方式为:

  9. Java程序中解决数据库超时与死锁

    Java程序中解决数据库超时与死锁 2011-06-07 11:09 佚名 帮考网 字号:T | T   Java程序中解决数据库超时与死锁,每个使用关系型数据库的程序都可能遇到数据死锁或不可用的情况 ...

  10. javascript 获取文档/屏幕的Width||Height

    document.body.clientWidth //网页可见区域宽度document.body.clientHeight //网页可见区域高度document.body.offsetWidth / ...