build.gradle更改为git子模块 [英] build.gradle changes for git submodule
问题描述
core // root
.gitmodules //这个包含了box-sdk作为子模块
box-sdk // git子模块
BoxJavaLibraryV2 // Box相关文件
我还创建了 settings.gradle
include'box-sdk :BoxJavaLibraryV2'
我的build.gradle
编译项目(':box-sdk:BoxJavaLibraryV2')
在这一点上,我能够编译和构建根框架作为依赖项的根项目。
当我尝试重新签入并检出整个项目时,问题就开始了。我确实如下:
我可以检入 .gitmodules
和 box-sdk目录
。但是我无法检查BoxJavaLibraryV2。
它错误地表示BoxJavaLibraryV2是一个子模块
我再次单独检出root,在那里我同时获得.gitmodules和box-sdk(不包含BoxJavaLibraryV2)
然后构建我的项目,我必须手动完成:
git submodule init
git子模块更新
gradle war
什么改变以及我需要做什么来消除初始化和更新步骤。
我在寻找的是:
当我结账 git master
gradle war
请帮助解决方案首先,您只能有一个步骤:
pre> git submodule update --init --recursive
第二个,Gradle本身有一个公开的问题(2010年以来)来整合该步骤:
GRADLE-21:简化将构建包含为git子模块的问题。
这个问题提出了各种方式,其中之一是制作一个gradle wrapper(在调用 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
).
这篇关于build.gradle更改为git子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!