gpt4 book ai didi

git - Gradle 更新 git 子模块

转载 作者:行者123 更新时间:2023-12-03 03:58:54 24 4
gpt4 key购买 nike

我有一个分为子模块的 gradle 项目。每次我需要使用最新源构建项目时执行 git submodule update --init 不是很方便,所以我想知道是否有已知的方法来创建一个 gradle 任务来做到这一点?也许有一个现有的插件? Unix 和 Windows 兼容性会很好。

回答后更新

正如@VonC所述ajoberstar/gradle-git完成工作。

这是我最终得到的配置

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.6.0'
}
}

apply plugin: 'org.ajoberstar.grgit'

task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}

task build

build.dependsOn submodulesUpdate

// ...

最佳答案

this pull request ,您可以尝试添加一个 gradle 任务来为您执行子模块初始化。
这将取决于并使用 ajoberstar/gradle-git .

task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}

关于git - Gradle 更新 git 子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50321417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com