git 子模块的 build.gradle 更改 [英] build.gradle changes for git submodule

查看:30
本文介绍了git 子模块的 build.gradle 更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

源码树如下:

core//根.gitmodules//这有 box-sdk 作为子模块box-sdk//git 子模块BoxJavaLibraryV2//盒子相关文件

我还创建了 settings.gradle

include 'box-sdk:BoxJavaLibraryV2'

我的 build.gradle

编译项目(':box-sdk:BoxJavaLibraryV2')

此时我能够编译和构建以 box 作为依赖项的根项目.

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

我能够检查.gitmodulesbox-sdk 目录.但我无法签入 BoxJavaLibraryV2.

它错误地说 BoxJavaLibraryV2 是一个子模块

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

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

git 子模块初始化git子模块更新毕业战争

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

我要找的是:

当我检查 git master 时,带有子模块的整个项目应该用 gradle war

构建

请帮忙

解决方案

首先,你可以只有一步:

git submodule update --init --recursive

其次,Gradle 本身有一个未解决的问题(自 2010 年以来)来集成该步骤:
GRADLE-21:通过将构建包含为 git 子模块来简化问题"..>

git clone --recursive 将克隆:检出您的存储库 子模块检出.

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

Source Tree is as follows:

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

I also created settings.gradle

include 'box-sdk:BoxJavaLibraryV2'

My build.gradle

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

At this point I was able to compile and build root project with box as dependency.

Problem started when I tried to checkin and checkout again the whole project. I did following:

I was able to check in .gitmodules and box-sdk directory. But I was not able to checkin BoxJavaLibraryV2.

It errored out saying BoxJavaLibraryV2 is a submodule

I checked out root again separately where I get both .gitmodules and box-sdk (without BoxJavaLibraryV2)

Then to build my project I had to do manually:

git submodule init
git submodule update
gradle war

What changes and where I need to do to eliminate init and update steps.

What I am looking for is:

when I checkout git master, the whole project with submodules should build with gradle war

Please help

解决方案

First, you can have only one step:

git submodule update --init --recursive

Second, Gradle itself has an open issue (since 2010) to integrate that step:
GRADLE-21: "Streamline issues with including the build as a git submodule".

A git clone --recursive would clone:checkout your repo with submodules checked out.

The issue suggests various ways, one of them being making a gradle wrapper (which would call the appropriate git submodule command before calling gradle).

这篇关于git 子模块的 build.gradle 更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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