所以我尝试将其添加到我的“复合”项目中
plugins {
id 'com.brightsparklabs.gradle.multi-git' version '1.3.0'
}
multiGitPluginConfig {
repositoriesDir = new File( '.' )
repositories = [
'a': 'git@bitbucket.org:xenworks/a.git',
'b': 'git@bitbucket.org:xenworks/b.git',
]
}
问题出在
settings.gradle
中rootProject.name = 'composite'
includeBuild( 'a' )
includeBuild( 'b' )
如果缺少“a”或“b”,gradle上的任何git命令将无法正常工作,因此我无法执行
./gradlew gitClone
。这个特定的插件不是必需的,我只是想弄清楚如何拥有一个“主”存储库,然后可以用来克隆其所有依赖项,并将其保留为独立的库。 最佳答案
您可以添加if
条件,以检查项目在本地是否可用。
就像是:
if (file("relative/dir/with/project/a").exists()) {
includeBuild( 'a' )
}
关于git - 如何在复合gradle项目中git clone?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47880167/