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 ...
随机推荐
- 元音字母A的发音规则
摘抄自百度文库 A/a的发音比较复杂,归纳起来有10种情况: 一.在重读开音节中读[ei]. 例如: plane [plein] radio [ˈreidiəu] wake [weik] pape ...
- DSP28335的SPI发送
#include "DSP2833x_Device.h"#include "DSP2833x_Examples.h"unsigned char table[]= ...
- 使用git客户端获取shiro
1.进入下载的目标文件夹右键( Git Bash Here )
- Android -- 与WEB交互在同一个会话Session中通信
Session与Cookie Cookie和Session都为了用来保存状态信息,都是保存客户端状态的机制,它们都是为了解决HTTP无状态的问题而所做的努力. Session可以用Cookie来实现, ...
- Notes of the scrum meeting(12.8)
meeting time:18:00~18:30p.m.,December 8th,2013 meeting place:20号公寓前 attendees: 顾育豪 ...
- 我教女朋友学编程html系列(5) html中table的用法和例子
女朋友不是学计算机的,但是现在从事计算机行业,做技术支持,她想学习编程,因此我打算每天教她一点点,日积月累,带她学习编程,如果其他初学者感兴趣,可以跟着学. 为了将table介绍的简单.生动,具有实战 ...
- merry Christmas
圣诞节的来历 圣诞节这个名称是基督弥撒的缩写. 弥撒是教会的一种礼拜仪式. 1.耶诞节是一个宗节,我们把它当作耶苏的诞辰来庆祝,因而又名耶诞节.这一天,世界所有的基督教会都举行特别的礼拜仪式.但是有很 ...
- Angular 2 Quickstart
写一个Angular 2的应用最基本的步骤概括为三步:写root组件,启动它(Boostrap),写index.html. 一些关于命名空间的基本知识 把所有代码放入一个立即调用函数中,通过传入一个空 ...
- POJ 2960 博弈论
题目链接: http://poj.org/problem?id=2960 S-Nim Time Limit: 2000MS Memory Limit: 65536K 问题描述 Arthur and h ...
- Ext中如何校验TextField的字段被修改了?
场景描述: 在form表单中有个sfzhm的字段,需要去后台进行sfzhm是否重复的校验,一开始使用了blur的event来去后台进行校验,后来发现在焦点离开时,及时数据没有发生变化,也会造 ...