java - 无法使用gradle构建

标签 java gradle jmonkeyengine

此错误消息是什么意思?

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find com.jme3:xmlpull-xpp3:3.0.0.20140325-SNAPSHOT.
  Searched in the following locations:
      https://jcenter.bintray.com/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/maven-metadata.xml
      https://jcenter.bintray.com/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.pom
      https://jcenter.bintray.com/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.jar
      https://repo1.maven.org/maven2/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/maven-metadata.xml
      https://repo1.maven.org/maven2/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.pom
      https://repo1.maven.org/maven2/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.jar
      https://mvnrepository.com/artifact/cz.advel.jbullet/jbullet/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/maven-metadata.xml
      https://mvnrepository.com/artifact/cz.advel.jbullet/jbullet/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.pom
      https://mvnrepository.com/artifact/cz.advel.jbullet/jbullet/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.jar
      https://mvnrepository.com/artifact/org.cogchar/ext.bundle.opengl.jmonkey/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/maven-metadata.xml
      https://mvnrepository.com/artifact/org.cogchar/ext.bundle.opengl.jmonkey/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.pom
      https://mvnrepository.com/artifact/org.cogchar/ext.bundle.opengl.jmonkey/com/jme3/xmlpull-xpp3/3.0.0.20140325-SNAPSHOT/xmlpull-xpp3-3.0.0.20140325-SNAPSHOT.jar
  Required by:
      :spaceworld:unspecified > org.cogchar:ext.bundle.opengl.jmonkey:1.1.3

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

BUILD FAILED

我的build.gradle

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'

mainClassName = 'spaceworld.SpaceUFO'

repositories {
    jcenter()
}

ext.jmeVersion = "[3.1,)"

project(":assets") {
    apply plugin: "java"

    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://mvnrepository.com/artifact/cz.advel.jbullet/jbullet"

    }
    maven {

        url "https://mvnrepository.com/artifact/org.cogchar/ext.bundle.opengl.jmonkey"

    }
}



dependencies {

    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    compile "org.jmonkeyengine:jme3-blender:$jmeVersion"
    compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"
    compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
    compile "org.jmonkeyengine:jme3-networking:$jmeVersion"

    compile group: "cz.advel.jbullet", name: "jbullet", version: "20101010"

    compile group: "org.cogchar", name: "ext.bundle.opengl.jmonkey", version: "1.1.3"

    compile files('libs/cai-nmgen-0.2.0.jar')

    runtime project(':assets')
}

task wrapper(type: Wrapper) {
}

task createDirs << {

    def pkg = 'spaceworld'
    def dirs = [
            file("./src/main/java/$pkg"),
            file("./src/main/resources"),
            file("./assets/Interface"),
            file("./assets/MatDefs"),
            file("./assets/Materials"),
            file("./assets/Models"),
            file("./assets/Scenes"),
            file("./assets/Shaders"),
            file("./assets/Sounds"),
            file("./assets/Textures"),
    ]

    dirs.each {
        if (!it.exists()) {
            println "Creating " + it
            it.mkdirs()
        }
        if (it.listFiles().length == 0) {
            def stub = new File(it, 'removeme.txt')
            println "Creating stub file to allow git checkin, file:$stub"
            stub.text = "Remove me when there are files here."
        }
    }
}

我不明白如何添加依赖项。

最佳答案

这意味着您指定的存储库中不存在依赖项 com.jme3:xmlpull-xpp3:3.0.0.20140325-SNAPSHOT

可能的原因:

  • 您拼错了依赖项。
  • 您遗漏了一个存储库。
  • 您的本地 Maven 存储库或 gradle 缓存已损坏。

考虑查看依赖关系树以找出该依赖关系从何而来以及如何解决该问题。

关于java - 无法使用gradle构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37989287/

相关文章:

java - 使用具有特殊字符的正则表达式标记字符串

java - 有谁知道查看 Java 应用程序内存的应用程序?或者有一些简单的方法来创建一个应用程序来做这种事情?在 C# 中

maven - 无法为 git 存储库中的 Gradle 子文件夹配置 Jenkins 作业。这适用于 Maven

java - 使用多线程 (jME3) 获取游戏状态

java - Nifty GUI "onClickRepeat"无法在 JME3 中的 "controlDefinition"中工作

java - 如何获得分布参数?

java - 为什么我似乎不能从 build.sbt 中排除这种传递依赖? (继续出现在ivyReport)

java - 无法运行 Gradle 应用引擎任务

spring - 使用 kotlin-spring 插件,仍然得到 class not open 错误

eclipse - 带有 jMonkeyEngine 的小程序?