Gradle:如何通过gradle执行git pull? [英] Gradle: How to perform git pull through gradle?
问题描述
我想在编译开始之前从git repo中提取更改。
我发现这个 Gradle:如何克隆一个任务中的git repo?,但它克隆了回购,而不是仅仅提取更改。
如果git服务器不在本地网络或回购很大,这可能会很耗时。
我无法找到<$ code> git pull 使用gradle或者 gradle-git插件。
您可以创建 Exec
任务并运行任何shell / cmd命令。简单任务不需要额外的插件依赖项。
任务gitPull(类型:Exec){
描述'Pulls git。'
commandLinegit ,pull
}
用法: gradlew gitPull
您应该看到如下所示:
gradlew gitPull
并行执行是一项孵化功能。
:app:gitPull
已经是最新的。
建立成功
总时间:9.232秒
其中已经是最新的。
是 git pull
命令的输出。
I want to pull changes from git repo before compilation begins. I found this Gradle: how to clone a git repo in a task?, but it clones the repo instead of fetching just the changes. This could be time consuming if the git server is not on the local network or if the repo is large.
I could not find how to do git pull
using gradle or the gradle-git plugin.
You can create Exec
task and run any shell/cmd command. No extra plugin dependency required for simple tasks.
task gitPull(type: Exec) {
description 'Pulls git.'
commandLine "git", "pull"
}
Usage: gradlew gitPull
You should see smth like this:
gradlew gitPull
Parallel execution is an incubating feature.
:app:gitPull
Already up-to-date.
BUILD SUCCESSFUL
Total time: 9.232 secs
Where Already up-to-date.
is the output from git pull
command.
这篇关于Gradle:如何通过gradle执行git pull?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!