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 fast feedback of our build status. If we don't want to this and want Gradle to execute all tasks, even though some might have failed, we use the command line option --continue. When we use the --continue command line option Gradle will execute every task where the dependent tasks are not failing. This is also useful in a multi-module project where we might want to build all projects even though some may have failing tests, so we get a complete overview of failed tests for all modules.
In the following Gradle build file we have two tasks. The task failTask throws a TaskExecutionException to purposely fail the task. The successTask will not fail:
00.task failTask << { task ->01.println "Running ${task.name}"02. 03.throw new TaskExecutionException(04.task, 05.new Exception('Fail task on purpose')) 06.}07. 08.task successTask << {09.println "Running ${it.name}"10.}Let's run both tasks from the command line and see the output:
$ gradle failTask successTask:failTaskRunning failTask:failTask FAILEDFAILURE: Build failed with an exception.* Where:Build file '/Users/mrhaki/samples/gradle/continue/build.gradle' line: 4* What went wrong:Execution failed for task ':failTask'.> Fail task on purpose* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDTotal time: 4.148 secs$We see the build has failed and only the task failTask is executed. Now we run the same two tasks, but we use the command line option --continue:
$ gradle --continue failTask successTask:failTaskRunning failTask:failTask FAILED:successTaskRunning successTaskFAILURE: Build failed with an exception.* Where:Build file '/Users/mrhaki/samples/gradle/continue/build.gradle' line: 4* What went wrong:Execution failed for task ':failTask'.> Fail task on purpose* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDTotal time: 6.918 secs$This time the successTask is executed even though the failTask has failed again. Gradle will keep track of all tasks that have failed and displays a summary with all the tasks that have failed.
Written with Gradle 2.2.1
Gradle Goodness: Continue Build Even with Failed Tasks的更多相关文章
- 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: Run a Build Script With a Different Name
Normally Gradle looks for a build script file with the name build.gradle in the current directory to ...
- 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: Task Output Annotations Create Directory Automatically
Gradle Goodness: Task Output Annotations Create Directory Automatically One of the great features of ...
- 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: Using and Working with Gradle Version
To get the current Gradle version we can use the gradleVersion property of the Gradle object. This r ...
- Gradle Goodness: Skip Building Project Dependencies
If we use Gradle in a multi-module project we can define project dependencies between modules. Gradl ...
- cordova build android Command failed with exit code EACCES
问题: 执行cordova build android 出现输出如下,编译不成功. ANDROID_HOME=/Users/huangenai/Library/Android/sdkJAVA_HOME ...
- Gradle Goodness: Copy Files with Filtering
Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...
随机推荐
- MVC 局部加载页面的实例
我们在做MVC 进行某一块的局部刷新,有的使用AJAX 请求,有的使用局部页: 下面我给大家推荐一种使用局部页面实现的这种方式: 第一步: 嵌套视图页 <div id="showAud ...
- LoadRunner - 实战,转发
最近几天一直在读代震军的博客,他是Discuz!NT的设计者,读了他的一系列关于 Discuz!NT的架构设计文章,大呼过瘾,特别是Discuz!NT在解决高访问高并发时所设计的一系列方案,本人尤其感 ...
- 修改ip脚本
1.打开运行 2.输入CMD 3.在命令提示符下输入: netsh -c interface ip dump > C:\我的网络配置.txt 4.打开您在C:\ 下的"我的网络配置 . ...
- LinuxC 文件与目录 打印文件操作错误信息
打印文件操作错误信息 在进行文件操作是,会遇到权限不足.找不到文件等错误,可以在程序中设置错误捕捉语句并显示错误.错误捕捉和错误输出使用用错误号和streero实现. 函数原型 : char *str ...
- STL学习三:deque容器
1.Deque简介 deque是“double-ended queue”的缩写,和vector一样都是STL的容器,deque是双端数组,而vector是单端的. deque在接口上和vector非常 ...
- mysql启动问题access denied for user 'root'@'localhost'(using password:YES)
安装Mysql后利用SQLyogEnt启动是提示“access denied for user 'root'@'localhost'(using password:YES)”,开始我还为是因为是密码问 ...
- Java实现文件压缩与解压[zip格式,gzip格式]
Java实现ZIP的解压与压缩功能基本都是使用了Java的多肽和递归技术,可以对单个文件和任意级联文件夹进行压缩和解压,对于一些初学者来说是个很不错的实例. zip扮演着归档和压缩两个角色:gzip并 ...
- 【Permutations】cpp
题目: Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the fo ...
- Segment Tree 分类: ACM TYPE 2014-08-29 13:04 97人阅读 评论(0) 收藏
#include<iostream> #include<cstdio> using namespace std; struct node { int l, r, m; int ...
- NENU_CS_segment_tree
单点更新 http://acm.hdu.edu.cn/showproblem.php?pid=1166 题意:单点更新加减,区间查询求和. #include<cstdio> #define ...