Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to apply plugin [id 'forge']

This is a continuation of this question My initial issue has been solved, but a new one came after.

Following the tutorial mentioned in it, having solved a few errors, I now get an error when I try to run .\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)

How do I set the Minecraft version? (1.7.10 in this instance)

Edit to include 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'
    }
}
like image 692
Benjamin Wall Avatar asked Jul 08 '26 16:07

Benjamin Wall


2 Answers

Good day.

For minecraft version 1.7.10.

I was with the same problem, searching the forum in Japanese. this link Forum

You have to modify the repositories and dependencies of the build.gradle and change the gradle-wrapper.properties to version 5.6.4.

As indicated in this link ForgeGradle-1.2

Contains an example to modify your 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

Sorry, my English is very basic. I'm using a translator.

like image 150
Correogoa Avatar answered Jul 11 '26 04:07

Correogoa


pls update the plugin to latest one . For reference check this link and link.

also try deleting the .gradle folder in your User Home and run it again.

like image 45
SHASHI SHEKHAR Barnwal Avatar answered Jul 11 '26 06:07

SHASHI SHEKHAR Barnwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!