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

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

问题描述

使用 Gradle 管理 Android 的依赖项是以一种奇怪的方式完成的.它们必须以不同的方式下载到本地存储库中.这在设置 CI 构建时很痛苦,因为它可以在多个节点上运行.因此,我使用 sdk-manager-plugin 在以下位置下载 Android 依赖项建造时间.我在使用 sdk 时似乎遇到了 一个老错误-manager-plugin 虽然它会在构建时下载依赖项,但它们在该命令中不可用.

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.

下次运行命令时一切正常(因为所有内容都已下载),但我需要找到一种方法来忽略第一个 gradle 命令的构建失败,以便下载所有内容并准备好进行第二个.我意识到这是 hacky,但我已经搞砸了.

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

我可以在 Gradle 文档中找到的最接近的东西是 --quite,但它看起来不起作用.

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.

推荐答案

要使用的标志是--continue.

来自文档:

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

Continues task execution after a task failure.

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

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