Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle:如何定义子路径为依赖项的sourceControl?_Gradle - Fatal编程技术网

Gradle:如何定义子路径为依赖项的sourceControl?

Gradle:如何定义子路径为依赖项的sourceControl?,gradle,Gradle,使用sourceControl标记,我想使用google的公共存储库作为我自己项目中的依赖项。存储库包含一些我想包含/使用的示例java类。但是,由于提供必要的gradle内容的gradle模块/项目位于存储库文件结构的更深处(=>不在根目录),我很难引用正确的URL。在my settings.gradle中,我添加了如下几行: sourceControl { gitRepository("https://github.com/google-ar/arcore-andro

使用sourceControl标记,我想使用google的公共存储库作为我自己项目中的依赖项。存储库包含一些我想包含/使用的示例java类。但是,由于提供必要的gradle内容的gradle模块/项目位于存储库文件结构的更深处(=>不在根目录),我很难引用正确的URL。在my settings.gradle中,我添加了如下几行:

 sourceControl {
      gitRepository("https://github.com/google-ar/arcore-android-sdk.git")) {
          producesModule("com.google.ar.core.examples:app")
      }
  }
我感兴趣的模块可以在

源依赖项是一个非常酷的特性,但遗憾的是,它的文档记录非常糟糕。在这种情况下,我们必须查看API文档。SourceControl的API是(这是您使用的最外层块)。在这里,我们可以看到可以通过配置
gitRepository
。在这里,我们看到除了
producesModule
方法之外,还有一个
setRootDir
方法,其描述如下:

void setRootDir​(字符串rootDir)

设置存储库中生成的根目录的相对路径

因此,根据您的存储库路径,尝试以下方法:

sourceControl {
    gitRepository("https://github.com/google-ar/arcore-android-sdk.git") {
        producesModule("com.google.ar.core.examples:app")
        rootDir = "samples/hello_ar_java"
    }
}