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. 读EntityFramework.DynamicFilters源码_心得_设计思想_04

    前几次,我们从说明文档,示例,单元测试了解了怎么用这个动态过滤器,那么如果仅仅是为了实现目的,知道怎么用就可以完成相应的功能开发,但我还想了解的问题是 作者是怎么将动态过滤器与EF结合的 有哪些设计思 ...

  2. TCP客户端 服务端详细代码

    本文章转自http://www.myexception.cn/program/1912019.html TCP网络编程中connect().listen()和accept()三者之间的关系 基于 TC ...

  3. JQuery总结摘要

    一 概述 1.JQuery是什么? JQuery是一个JavaScript库,简化了JS操作,扩展了JS功能. 2.分离原则 JQuery遵循导入与使用分离的原则,即使用一个<script> ...

  4. webstorm添加自定义代码块

    widnow下使用alt+ctrl+s 调出setting面板 mac下使用command+,(逗号)调出Preferences面板 搜索live template选中js,在javascrpt 模板 ...

  5. eclipse插件开发常见的问题及解决办法

    莫名其妙地我的某个Plug-in Projects出现了这样的Error:An API baseline has not been set for the current workspace.虽然后来 ...

  6. <Android 应用 之路> 百度地图API使用(1)

    简介 详情请看百度地图官方网站 http://lbsyun.baidu.com/index.php?title=androidsdk/guide/introduction 使用方式 申请密钥,针对移动 ...

  7. Java 之初(1)

    省赛结束之后有相当长一段空闲时间,于是就想先提前自学一点Java语言的知识,在这里纪录一下学习过程,希望能给自学Java的同学提供一点小帮助!(当然,也能方便我以后的复习用^_^) 在学习过程中有什么 ...

  8. 解决MFC对话框类不能建立成功的方法(出现unable to open the files XX for class XX)

    原文:http://blog.163.com/wangqi1973_off/blog/static/131034571201011885546230 为新加的对话框资源添加新类,类名取做CColorV ...

  9. 【Web crawler】simulated DFS web crawler

    Finish crawl web learned from udacity 提示:在某些时候,你必须在page上调用get_page.这似乎违反直觉,但是我们用 page 这个词时,指的网页的网址 ( ...

  10. java自增(自减)运算符

    自增(自减)运算符: ++ --就是可以将当前变量自我增加(减少)1 的运算符. i++, 后++, 先将 i 的值作为整个表达的值, 然后将 i 增加 1. ++i, 先++, 先将 i 增加 ...