Java gradle 编译文件树语法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18925908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gradle compile filetree syntax
提问by CQM
folder structure:
文件夹结构:
- RootProject Folder
- MyMainProject
- MyLibraries
- Facebook
The root project folder has a build.gradle file, but MyMainProject has the one with all the dependencies.
根项目文件夹有一个 build.gradle 文件,但 MyMainProject 有一个包含所有依赖项的文件。
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':MyLibraries:Facebook')
}
I feel like compile project
doesn't have the correct path. Is there a way to make it look up a directory, so something like ../MyLibraries/Facebook
? I don't completely understand the colon (:) syntax
我觉得compile project
没有正确的路径。有没有办法让它查找目录,比如../MyLibraries/Facebook
?我不完全理解冒号 (:) 语法
采纳答案by Peter Niederwieser
You need a settings.gradle
, and the dependency presumably needs to be declared as project(':Facebook')
. (According to the folder structure, MyLibraries
and Facebook
are siblings.) For more information, see the multi-project builds chapter in the Gradle User Guide. I don't understand why you think this is connected to the fileTree
syntax, and I don't see libs
in your folder structure.
您需要一个settings.gradle
,并且该依赖项大概需要声明为project(':Facebook')
。(根据文件夹结构,MyLibraries
并且Facebook
是同级。)有关更多信息,请参阅Gradle 用户指南中的多项目构建章节。我不明白你为什么认为这与fileTree
语法有关,而且我libs
在你的文件夹结构中没有看到。