Gradle无法找到项目(无法找到路径为$的项目)

时间:2017-06-30 23:58:47

标签: gradle libgdx

此项目(示例)取决于父目录中定义的项目。它根本不是父目录项目构建的一部分。但是,Gradle永远不会在我的任何文件夹中找到包含项目的项目。父目录包含libGDX的多平台多项目库项目。到目前为止,我无法调用project()并在任何目录中找到它...

FAILURE: Build failed with an exception.

    * Where:
    Settings file '/home/athenacadence/git/gdx-complextext/example/settings.gradle' line: 2

    * What went wrong:
    A problem occurred evaluating settings 'example'.
    > Project with path '/../html' could not be found.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    CONFIGURE FAILED

    Total time: 0.124 secs

GDX-complextext /示例/ settings.gradle

include 'desktop', 'android', 'ios', 'html', 'core', 'ios-moe'
includeBuild(project("/../html"))

GDX-complextext /的build.gradle

ext {
    GROUPID = 'com.athenaeumapps.gdxcomplextext'
    VERSION = '0.0.1-SNAPSHOT'

}

buildscript {
    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
        maven { url uri(System.getenv("INTEL_MULTI_OS_ENGINE_HOME") + "/gradle") }
    }
    dependencies {
        classpath 'com.goharsha:gwt-opentype:0.1-SNAPSHOT'
    classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.android.tools.build:gradle:2.1.3'
        classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.0'
        classpath group: 'org.multi-os-engine', name: 'moe-gradle', version: '1.1.+'
    }
}

allprojects {
    apply plugin: "eclipse"

    ext {
        appName = 'gdx-complextext'
        gdxVersion = '1.9.6'
        roboVMVersion = '2.2.0'
    }

    repositories {
        mavenCentral()
        mavenLocal()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }

    group = GROUPID
    version = VERSION
}

project(":android") {
    configurations {
        custom
        compile.extendsFrom custom
    }

    eclipse {
        project {
            name = appName + "-android"
        }
    }

    dependencies {
        compile project(':core')
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"

    }
}


project(":core") {
    apply plugin: 'java'

    apply from: '../publish.gradle'

    configurations {
        custom
        compile.extendsFrom custom
    }

    eclipse {
        project {
            name = appName + "-core"
        }
    }

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    }
}




project(":desktop") {
    apply plugin: 'java'

    apply from: '../publish.gradle'

    configurations {
        custom
        compile.extendsFrom custom
    }

    eclipse {
        project {
            name = appName + "-desktop"
        }
    }

    dependencies {
        compile project(':core')
    }
}


project(":html") {
    apply plugin: 'java'


    apply from: '../publish.gradle'

    configurations {
        custom
        compile.extendsFrom custom
    }

    eclipse {
        project {
            name = appName + "-html"
        }
    }

    dependencies {
        compile project(':core')
    }
    dependencies {
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
    }
}



project(":ios") {
    apply plugin: 'java'
    apply plugin: 'robovm'

    apply from: '../publish.gradle'

    configurations {
        custom
        compile.extendsFrom custom
    }

    eclipse {
        project {
            name = appName + "-ios"
        }
    }

    dependencies {

        compile project(':core')

        compile "com.mobidevelop.robovm:robovm-rt:${roboVMVersion}"
        compile "com.mobidevelop.robovm:robovm-cocoatouch:${roboVMVersion}"
        compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"

    }
}


project(":ios-moe") {
    apply plugin: 'java'
    apply plugin: 'moe'


    apply from: '../publish.gradle'

    configurations {
        custom
        compile.extendsFrom custom
        natives
    }

    eclipse {
        project {
            name = appName + "-ios-moe"
        }
    }

    dependencies {

        compile project(':core')

        compile "com.badlogicgames.gdx:gdx-backend-moe:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
    }
}

修改

尝试使用includeBuild后,我明白了:

includeBuild( “$ {rootProject.projectDir} /../ HTML”)

1 个答案:

答案 0 :(得分:0)

请尝试使用其他方式使用rootProject.projectDir获取项目位置,然后添加../html,同样根据documentation,无需包含project例如仅使用includeBuild,如下所示:

includeBuild("${rootProject.projectDir}/../html")

可以找到另一个例子here