我有2个Gradle项目都在同一目录中。目录结构如下:

ParentDirectory\
    GradleProjectA\
        build.gradle
    GradleProjectB\
        settings.gradle
        build.gradle

我想将GradleProjectA作为依赖项添加到GradleProjectB。在settings.gradleGradleProjectB中,我尝试添加include 'GradleProjectA',然后在build.gradle中添加:compile project(':GradleProjectA'),但这没有用。

任何帮助将不胜感激。谢谢。

最佳答案

我做这样的事情的方式如下:
GradleProjectB/settings.gradle:

include ':GradleProjectA'
project(':GradleProjectA').projectDir = new File('../GradleProjectA')
GradleProjectB/build.gradle:
compile project(":GradleProjectA")

关于java - Gradle本地项目依赖性,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36479097/

10-13 03:40