无法应用插件 [id 'forge']

Failed to apply plugin [id 'forge']

这是 的延续,我最初的问题已经解决,但后来又出现了一个新问题。

按照其中提到的教程,解决了一些错误,现在尝试 运行 .\gradlew tasks:

时出现错误
FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\benji\MinecraftWorkspace\forge-1.7.10-10.13.4.1614-1.7.10-src\build.gradle' line: 18

* What went wrong:
A problem occurred evaluating root project 'forge-1.7.10-10.13.4.1614-1.7.10-src'.
> Failed to apply plugin [id 'forge']
   > You must set the Minecraft Version!
      > java.lang.NullPointerException (no error message)

如何设置我的世界版本? (本例中为 1.7.10)

编辑以包含 build.gradle:

buildscript {
    repositories {
        mavenCentral()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
}

apply plugin: 'forge'

version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

minecraft {
    version = "1.7.10-10.13.4.1614-1.7.10"
    runDir = "eclipse"
}

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"

    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources
{
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'

        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }

    // copy everything else, thats not the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

请将插件更新到最新版本。作为参考检查此 link and link

也尝试删除您用户主目录中的 .gradle 文件夹,然后再 运行 删除它。

我通过安装 'Recommended' 版本的 Forge 1.7.10 而不是 'Latest' 解决了这个问题。确实很简单,虽然我已经打了另一个 .

美好的一天。

我的世界版本 1.7.10。

我也遇到了同样的问题,用日语搜索论坛。 这个linkForum

您必须修改 build.gradle 的存储库和依赖项,并将 gradle-wrapper.properties 更改为版本 5.6.4。

如本文所示linkForgeGradle-1.2

包含修改您的 build.gradle example

的示例

build.gradle

buildscript {
repositories {
    mavenCentral()
    maven { url = "https://jcenter.bintray.com/" }
    maven {
        name = "forge"
        url = "https://files.minecraftforge.net/maven"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/repositories/snapshots/"
    }
}
dependencies {
    classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') {
        changing = true
    }
}

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip

I made it work

抱歉,我的英语很基础。我正在使用翻译器。