Gradle 按绝对路径添加本地渐变源模块
我想在Gradle项目中添加一个子项目。项目位于我硬盘上的某个位置,例如:Gradle 按绝对路径添加本地渐变源模块,gradle,include,absolute,Gradle,Include,Absolute,我想在Gradle项目中添加一个子项目。项目位于我硬盘上的某个位置,例如: /A/Path/to/a/ProjectA /Another/Path/to/another/ProjectB 我想要实现的是将ProjectB用作项目a中的源模块。然而,到目前为止,我所有的尝试都是通过添加include/other/Path/to/other/ProjectB或添加include':ProjectB';settings.gradle中的project(':ProjectB').projectDir=
/A/Path/to/a/ProjectA
/Another/Path/to/another/ProjectB
我想要实现的是将ProjectB用作项目a中的源模块。然而,到目前为止,我所有的尝试都是通过添加include/other/Path/to/other/ProjectB
或添加include':ProjectB';settings.gradle中的project(':ProjectB').projectDir=…
-刚刚失败。显然,格雷德尔找不到这个项目
如何在不将ProjectB从其位置移动的情况下将其添加为依赖项?使用Gradle 3.4.1,以下内容适用于我(完整示例): 谢谢你的回复。 结果我犯了几个错误:
现在可以了。再次感谢大家 一般来说,您提出的解决方案(使用settings.gradle)非常有效。您是否将:ProjectB依赖项添加到ProjectA(build.gradle)中?
include 'app', 'common'
def MY_PATH = '/Users/johndoe/foo'
assert new File("$MY_PATH/random/path/common").exists()
project(':common').projectDir = new File("$MY_PATH/random/path/common")