忽略Gradle构建失败并继续构建脚本? [英] Ignore Gradle Build Failure and continue build script?

查看:154
本文介绍了忽略Gradle构建失败并继续构建脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用Gradle管理Android的依赖关系是以一种奇怪的方式完成的。他们必须以不同的方式下载到当地的回购协议中。由于有多个节点可以运行,因此设置CI构建时很痛苦。因此,我使用 sdk-manager-plugin 将Android依赖关系下载到建立时间。似乎有一个老的bug ,我正在使用sdk -manager-plugin,但它会在构建时下载依赖关系,但它们不会在该命令中可用。



下次运行命令时,工作正常(因为所有东西都已经下载了),但是我需要找到一种方法来忽略第一个gradle命令的构建失败,这样所有的东西都被下载,并且第二个很好。我认识到这很不方便,但我已经完成了这件事。



理想的情况是这样的:

  ./ gradlew clean --ignoreBuildFailures 
./gradlew distributeCIBuild

我在Gradle文档中找到的最接近的东西是--quite,但看起来并不像它能工作。



欢迎任何创意解决方案。

解决方案

使用的标志是 - 继续 p>

文档


在任务失败后继续执行任务。


Managing Android's dependencies with Gradle is done in a weird way. They have to be downloaded differently into a local repo. This is a pain when setting up CI build as there are multiple nodes this could run on. As such I'm using the sdk-manager-plugin to have the Android dependencies downloaded at build time. There seems to be an old bug that I'm experiencing with the sdk-manager-plugin though in that it will download the dependencies at build time, but they won't be available on that command.

The next time the command is run everything works fine (as everything is already downloaded), but I need to find a way to ignore the build failure of the first gradle command so that everything is downloaded and good to go for the second. I realize this is hacky, but I'm done messing with this.

Ideally something like this would work:

./gradlew clean --ignoreBuildFailures
./gradlew distributeCIBuild

The closest thing I could find in the Gradle documentation is --quite but that doesn't look like it'd work.

Any creative solutions welcome.

解决方案

The flag to use is --continue.

From the documentation:

Continues task execution after a task failure.

这篇关于忽略Gradle构建失败并继续构建脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆