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 group and if we look at the output of the tasks task we can see our tasks grouped in section with the given name. In the next sample we create a new task publish and assign it the group name Publishing.
0.task publish(type: Copy) {1.from "sources"2.into "output"3.}4. 5.configure(publish) { 6.group = 'Publishing'7.description = 'Publish source code to output directory'8.}If we execute tasks we get the following output:
$ gradle tasks :tasks------------------------------------------------------------All tasks runnable from root project------------------------------------------------------------Help tasks----------dependencies - Displays the dependencies of root project 'taskGroup'.help - Displays a help messageprojects - Displays the sub-projects of root project 'taskGroup'.properties - Displays the properties of root project 'taskGroup'.tasks - Displays the tasks runnable from root project 'taskGroup' (some of the displayed tasks may belong to subprojects).Publishing tasks----------------publish - Publish source code to output directoryTo see all tasks and more detail, run with --all.BUILD SUCCESSFULTotal time: 2.327 secsSuppose we apply the Java plugin to our project. We get a lot of new tasks, which are already in groups with names like Build and Documentation. If we want to add our own custom tasks to one of those groups we only have to use the correct name for the group property of our task. In the following build file we apply the Java plugin and use the Build group name as a group name for our task. The name is defined as a constant of the BasePlugin.
00.apply plugin: 'java'01. 02.task publish(type: Copy) {03.from 'sources'04.into 'output'05.}06. 07.configure(publish) { 08.group = BasePlugin.BUILD_GROUP // Or use 'build'09.description = 'Publish source code to output directory'10.}When we run tasks again we can see our task is in the Build section together with the tasks added by the Java plugin:
$ gradle tasks :tasks------------------------------------------------------------All tasks runnable from root project------------------------------------------------------------Build tasks-----------assemble - Assembles all Jar, War, Zip, and Tar archives.build - Assembles and tests this project.buildDependents - Assembles and tests this project and all projects that depend on it.buildNeeded - Assembles and tests this project and all projects it depends on.classes - Assembles the main classes.clean - Deletes the build directory.jar - Assembles a jar archive containing the main classes.publish - Publish source code to output directorytestClasses - Assembles the test classes.Documentation tasks-------------------javadoc - Generates Javadoc API documentation for the main source code.Help tasks----------dependencies - Displays the dependencies of root project 'taskGroup'.help - Displays a help messageprojects - Displays the sub-projects of root project 'taskGroup'.properties - Displays the properties of root project 'taskGroup'.tasks - Displays the tasks runnable from root project 'taskGroup' (some of the displayed tasks may belong to subprojects).Verification tasks------------------check - Runs all checks.test - Runs the unit tests.Rules-----Pattern: build<configurationname>: Assembles the artifacts of a configuration.Pattern: upload<configurationname>: Assembles and uploads the artifacts belonging to a configuration.Pattern: clean<taskname>: Cleans the output files of a task.To see all tasks and more detail, run with --all.BUILD SUCCESSFULTotal time: 2.896 secsGradle Goodness: Adding Tasks to a Predefined Group的更多相关文章
- Gradle Goodness: Excluding Tasks for Execution
In Gradle we can create dependencies between tasks. But we can also exclude certain tasks from those ...
- 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 ...
- 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. ...
- 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 ...
- Gradle Goodness: Task Output Annotations Create Directory Automatically
Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...
- 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 ...
- 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 ...
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
- 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 ...
随机推荐
- 2013 Warm up 3 -- Skill --- dp
题意:求n位数字,满足非递减的个数. dp[ i ] [ j ] = sum( dp[i -1] [ k ] ); k =>( j , 9); #include<iostream> ...
- java设计模式-观察者模式学习
最近学习了设计模式中的观察者模式,在这里记录下学习成果. 观察者模式,个人理解:就是一个一对多模型,一个主体做了事情,其余多个主体都可以观察到.只不过这个主体可以决定谁去观察他,以及做什么事情可以给别 ...
- 第9章 CSS3中的变形与动画(下)
Keyframes介绍 Keyframes被称为关键帧,其类似于Flash中的关键帧.在CSS3中其主要以"@keyframes"开头,后面紧跟着是动画名称加上一对花括号" ...
- K2P刷机教程转自恩山磨人的小妖精
K2P刷机指南说明 K2P MTK版发布之初用的是22.5.7.85, 这个版本官改和高恪K2P固件都可以从斐讯固件基础上直接升级, 是所谓直刷.但好景不长, 之后的版本比如22.5.17.33就改了 ...
- 如何让div覆盖canvas元素
第一步 请让该div和canvas同样处于同一画布,都用position:absolute; 然后设置canvas的z-index="-1",是的,你没看错 然后把要覆盖canva ...
- CSS3,3D效果轮播图
---恢复内容开始--- 大家还记得我昨天的3D拖拽立方体吗??我昨天还说过css还可以做轮播图,所以咱们今天就写一下,css的轮播图吧! ....这个轮播图主要是用CSS3里的transform的旋 ...
- easyui grid 里的可编辑text 加清空图标
$.extend($.fn.datagrid.defaults.editors, { text: { init: function (container, options) { var _opt = ...
- 139.00.006 Git学习-标签管理Tag
@(139 - Environment Settings | 环境配置) 一.Why 发布一个版本时,我们通常先在版本库中打一个标签(tag),这样,就唯一确定了打标签时刻的版本.将来无论什么时候,取 ...
- Python学习---深浅拷贝的学习
浅拷贝copy(): 修改字符串,原来的不变: 更改列表,2个同时修改,以为列表里面还涉及一个指针的索引. 简单讲就是copy()只是简单地copy了第一层,第二层不被copy 深拷贝: 需要单独的 ...
- Linux账号管理和ACL
by zjmyster version :1.2 Linux账号管理和ACL权限设置: 主要相关配置文件:/etc/passwd /etc/shadow /etc/group /etc/gshadow ...