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. jQuery bind()与delegate()的区别

    笔试题: bind()与delegate()的区别主要有三点: 1 绑定目标 .bind直接绑在目标元素上 .delegate绑在父元素上 2  监听个数 .bind监听个数多——每个目标元素都需要添 ...

  2. css文本内容显示省略号

    文字显示省略号width: 4.5rem;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; 但是这个属性只支持单行文本的溢出显 ...

  3. vue如何下载报表

    _export() { const _c = this.$createElement; this.$msgbox({ title: '请确认', showCancelButton: true, con ...

  4. osgEarth编译——以VS2012为例

    整理记录下 osgEarth编译过程. osgEarth是依赖于OSG的三维地理平台. 准备工作 OpenSceneGraph-3.4.0.zip OSG_3RDPARTY_DIR    http:/ ...

  5. CSS的下拉菜单被挡住,修改Z-INDEX也不成功

    CSS的下拉菜单被挡住,修改Z-INDEX也不成功 做了一个鼠标放上去就出现的下拉菜单,但是这个下拉的内容被挡住了. Z-INDEX 是设置不同块的层次的,我修改了问题还是有. 后来发现是必须要把该便 ...

  6. Android8.0适配那点事(二)

    小伙伴们,咱们今天咱继续对Android8.0的适配进行分解,今天将针对启动页,版本适配和系统限制等进行“啃食” 猛戳这里查看Android8.0适配那点事(一): 1.启动页适配 近日,我无意中发现 ...

  7. 关于App的cpu/内存/流量 /电量的方法(GT工具)

    https://mp.weixin.qq.com/s?__biz=MzUzNTQxMzMzMg==&mid=2247484376&idx=1&sn=651e9cf22801b5 ...

  8. 星空灯改装成USB供电

    简单的手工活,20分钟搞定 1.用一根USB线剪断,将红黑两根线分别连接到星空灯电源供电的正负极 2.由于USB输出5V 0.5A的电流,因此需要改装下,办法一,加电阻,办法二,换灯泡,由于小电阻并不 ...

  9. 爬虫day02

    s10day112 内容回顾: 第一部分:爬虫相关 1. 谈谈你对http协议的理解? 规范: 1. Http请求收发数据的格式 GET /index/ http1.1/r/nhost:xxx.com ...

  10. 三、python小功能记录——杀掉进程

    import os os.system("taskkill /F /IM python.exe")#旧版 os.system("taskkill /F /IM py.ex ...