In Gradle we can assign a task to a group. Gradle uses the group for example in the output of $ gradle -t to output all the tasks of the same group together. We only have to set the group property with a value and our task belongs to a group.

In the following sample we add the tasks hello and bye to the group Greeting:

00.def GREETING_GROUP = 'Greeting'
01. 
02.task hello << {
03.println 'Hello Gradle!'
04.}
05.hello.group = GREETING_GROUP
06.hello.description = 'Say hello.'
07. 
08.task bye {
09.description= 'Say goodbye.'
10.group = GREETING_GROUP
11.}
12.bye << {
13.println 'Goodbye.'
14.}

If we run $ gradle -t we get the following output:

:tasks
 
------------------------------------------------------------
Root Project
------------------------------------------------------------
 
Greeting tasks
--------------
bye - Say goodbye.
hello - Say hello.
 
Help tasks
----------
dependencies - Displays a list of the dependencies of root project 'taskgroup'.
help - Displays a help message
projects - Displays a list of the sub-projects of root project 'taskgroup'.
properties - Displays a list of the properties of root project 'taskgroup'.
tasks - Displays a list of the tasks in root project 'taskgroup'.
 
To see all tasks and more detail, run with --all.

Gradle Goodness: Group Similar Tasks的更多相关文章

  1. Gradle Goodness: Display Available Tasks

    To see which tasks are available for our build we can run Gradle with the command-line option -t or ...

  2. Gradle Goodness: Automatic Clean Tasks

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

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

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

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

  6. Gradle Goodness: Task Output Annotations Create Directory Automatically

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

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

  9. Gradle Goodness: Excluding Tasks for Execution

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

随机推荐

  1. php中怎么导入自己写的类

    如果写的类是写在当前php文件内,就直接实例化若你的类写在其他的php文件里,就要先用include或require,将类文件引入<?php include("class.php&qu ...

  2. com.alibaba.fastjson.JSONObject循环给同一对象赋值会出现"$ref":"$[0]"现象问题

    1.今天定义了一个JSONObject对象,引用的com.alibaba.fastjson.JSONObject,循环给这个对象赋值出现"$ref":"$[0]" ...

  3. C语言——二叉排序树

    二叉排序树是一种实现动态查找的树表,又称二叉查找树. 二叉排序树的性质: 1. 若它的左子树不为空,则左子树上所有节点的键值均小于它的根节点键值 2. 若它的右子树不为空,则右子树上所有节点的键值均大 ...

  4. 使用ArcGIS Chef Cookbook轻松搞掂WebGIS平台部署

    1.安装Chef Client v12版本. 2.复制arcgis cookbook资源到Chef安装目录. 3.考虑到一般部署的服务器环境无法连接互联网,所以需要事先部署ArcGIS Cookboo ...

  5. Monitorix:一款面向Linux的轻型系统和网络监测工具

    Monitorix是一款功能非常强大的免费开源轻型工具,目的在于监测Linux中的系统和网络资源.它可以定期收集系统和网络数据,并使用自己的Web界面,通过图形显示相关信息.Monitorix让用户可 ...

  6. 【转】怎么用PHP发送HTTP请求(POST请求、GET请求)?

    file_get_contents版本: /** * 发送post请求 * @param string $url 请求地址 * @param array $post_data post键值对数据 * ...

  7. linux下C语言三种get输入方式

    第一种:scanf() #include "stdio.h" #include "string.h" int main() { ]; scanf("% ...

  8. 使用 docker-machine 管理 Azure 容器虚拟机

    安装 docker-machine 请参见该链接(https://docs.docker.com/machine/install-machine "https://docs.docker.c ...

  9. Navicat for mysql 导出导入的问题

    问题现象   1:使用navicat 导出5.6.20版本数据库,然后导入到5.7.19mysql出现错误:  

  10. 实用的JS正则表达式(手机号码/IP正则/邮编正则/电话等)

    //校验是否全由数字组成 function isDigit(s) { var patrn=/^[0-9]{1,20}$/; if (!patrn.exec(s)) return false retur ...