如何包括来自另一个项目的回购库模块? [英] How to include a library module from another project's repo?

查看:194
本文介绍了如何包括来自另一个项目的回购库模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从 SmartGit 创建一个子模块做同样的,但它实际上拷贝完整的项目;而且我不能将它作为我用尝试::old_project_name:common_lib 不工作。下面请阅读详细信息:

I tried to do the same by creating a submodule from SmartGit but it actually copies the full project; moreover I am not able to include it as I have to try using: :old_project_name:common_lib which doesn't work. Kindly read below for more details:

新项目的结构我想:结果
- LIB 1模块结果
- LIB 2模块结果
- ....结果
- 应用模块结果
- 常见的lib模块(我想从具有相同的结构,这个新项目,但是现有项目此模块的常用的lib 是部分老项目本身)

The new project's structure I want:
- lib 1 module
- lib 2 module
- ....
- application module
- common lib module (I want this module from an existing project which has the same structure as this new project but the common lib is part of the old project itself)

推荐答案

只需使用:

Project
|__build.gradle
|__settings.gradle
|__app (application module)
   |__build.gradle
|__lib1 (lib 1)
   |__build.gradle
|__lib2 (library 2)
   |__build.gradle

settings.gradle

include ':app' , ':lib1' , 'lib2'
include ':commonLib'
project(':commonLib').projectDir=new   File('pathLibrary')

应用程序/的build.gradle

dependencies {
    compile project(':lib1')
    compile project(':lib2')
    compile project(':commonLib')
}

讲究commonLib。你必须使用该项目的其他项目,不是root

这篇关于如何包括来自另一个项目的回购库模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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