Gradle-多项目与外部项目? [英] Gradle- Multi-project with outside projects?
问题描述
Gradle多项目设置中无法在主项目文件夹之外使用外部依赖项吗?
像在 settings.gradle
文件中,我可以没有像
include'C:\some\path\to\dependent\project\ChildA','ChildB'
还是必须总是在父项目文件夹中包含相关项目?
假设以下文件系统层次结构:
|
\工作区
|
\
MyProject
|
\
DependencyA
将以下内容添加到 settings.gradle
in MyProject
:
include'..:DependencyA'
并在您的内部 build.gradle
MyProject
依赖关系{
compile project(':..:DependencyA')
}
重复as许多项目依赖于 DependencyA
。
Is it not possible in a Gradle multi-project setup to use external dependencies outside the main project folder?
Like in the settings.gradle
file, can I not have something like
include 'C:\some\path\to\dependent\project\ChildA','ChildB'
or do I have to always include the dependent projects in the parent project folder?
Assuming the following filesystem hierarchy:
|
\ workspace
|
\
MyProject
|
\
DependencyA
Add the following into your settings.gradle
in MyProject
:
include '..:DependencyA'
and inside your inner build.gradle
of MyProject
dependencies {
compile project(':..:DependencyA')
}
Repeat for as many projects as you have that depend on DependencyA
.
这篇关于Gradle-多项目与外部项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!