【问题标题】:build.gradle changes for git submodulegit 子模块的 build.gradle 更改
【发布时间】:2014-02-17 19:48:03
【问题描述】:

源码树如下:

core               // root
  .gitmodules     // this has box-sdk as submodule
  box-sdk          // git submodule
     BoxJavaLibraryV2     // Box related files

我还创建了settings.gradle

include 'box-sdk:BoxJavaLibraryV2'

我的 build.gradle

compile project(':box-sdk:BoxJavaLibraryV2')

此时,我能够编译和构建使用 box 作为依赖项的根项目。

当我尝试再次签入和签出整个项目时,问题就开始了。我做了以下操作:

我能够签入.gitmodulesbox-sdk directory。但我无法签入 BoxJavaLibraryV2。

It errored out saying BoxJavaLibraryV2 is a submodule

我再次单独检查了 root,我得到了 .gitmodules 和 box-sdk(没有 BoxJavaLibraryV2)

然后我必须手动构建我的项目:

git submodule init
git submodule update
gradle war

为了消除初始化和更新步骤,我需要做哪些更改以及需要做些什么。

我正在寻找的是:

当我结帐 git master 时,带有子模块的整个项目应该使用 gradle war 构建

请帮忙

【问题讨论】:

    标签: git maven ant gradle


    【解决方案1】:

    首先,你只能有一个步骤:

    git submodule update --init --recursive
    

    其次,Gradle 本身有一个未解决的问题(自 2010 年以来)来集成该步骤:
    GRADLE-21: "Streamline issues with including the build as a git submodule"

    git clone --recursive 将克隆:签出您的仓库 签出子模块。

    该问题提出了多种方法,其中一种是制作 gradle 包装器(在调用 gradle 之前调用适当的 git 子模块命令)。

    【讨论】:

      猜你喜欢
      • 2019-08-09
      • 1970-01-01
      • 2012-06-07
      • 2023-01-19
      • 1970-01-01
      • 2012-05-06
      • 2019-02-22
      • 2018-10-15
      • 2017-10-05
      相关资源
      最近更新 更多