Old Setup No Longer Works

I had an old setup that allowed me to test plugins (with Forge mod compatibility) inside a dev workspace but that setup no longer seems to work. Gradle now gives me the following error: class net.minecraftforge.gradle.user.patcherUser.PatcherUserBasePlugin overrides final method afterEvaluate.()V for project :Sponge (the name of my local copy of the SpongeForge project).

If the Gradle build file is necessary to debug this, here it is

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        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'
        classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
    }
}

apply plugin: 'forge'
apply plugin: 'maven'

repositories {
    maven {
        name 'Sponge API'
        url 'http://repo.spongepowered.org/maven'
    }
}

evaluationDependsOn('Sponge')

def buildProperties = new Properties()
buildProperties.load(new FileReader(file("build.properties")))

// Debug

// End of Debug

task projectData {
    ext.version = buildProperties.version_major + "." + buildProperties.version_minor + "." + buildProperties.version_revision + "_B" + buildProperties.build
    ext.mcversion = "1.8"
}

// ArchivesBaseName defined here
version = projectData.mcversion + "-" + projectData.version
// Group statement here

ext.mixinSrg = new File(project("Sponge").buildDir, "tmp/mixins/mixins.srg")
ext.mixinRefMap = new File(project("Sponge").buildDir, "tmp/mixins/mixins.sponge.refmap.json")

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

minecraft {
    version = "1.8-" + project("Sponge").forgeVersion
    mappings = project("Sponge").minecraft.mappings

    if (project.hasProperty("rundir")) {
        runDir = project.rundir
} else {
        runDir = "../.server"
    }
}


dependencies {
    compile project("Sponge")
    compile fileTree(dir: "libs", include: "**.jar")
}

processResources {
    from(sourceSets.main.resources.srcDirs) {
        expand 'version': projectData.version, 'mcversion': projectData.mcversion 
    }
}

task update << {
    def properties = new Properties()
    properties.load(new FileReader(file("build.properties")))

    if (project.hasProperty("updateto")) {
        properties.build = (properties.build.toInteger() + 1).toString()
        if (updateto == "major") {
            properties.version_major = (properties.version_major.toInteger() + 1).toString()
            properties.version_minor = "0"
            properties.version_revision = "0"
        } else if (updateto == "minor") {
            properties.version_minor = (properties.version_minor.toInteger() + 1).toString()
            properties.version_revision = "0"
        } else if (updateto == "revision") {
            properties.version_revision = (properties.version_revision.toInteger() + 1).toString()
        } else {
            println "Version was not changed!"
            properties.build = (properties.build.toInteger() - 1).toString()
        }
        properties.store(file("build.properties").newWriter(), null)
    } else {
        println "Version was not changed!\nTo change the version, change the \"updateto\" property to \"major\", \"minor\" or \"revision\""
    }
}

// Apply the access transformers of the subprojects
subprojects.each {
    it.sourceSets.main.resources.files.each {
        if (it.name.endsWith('_at.cfg')) {
            logger.lifecycle('Found AccessTransformer in dependency resources: $it.name')
            tasks.deobfBinJar.addTransformer(it)
            tasks.deobfuscateJar.addTransformer(it)
        }
    }
}

sourceSets {
    main {
        java {
            srcDirs = ["src"]
        }
    }
}

tasks.withType(JavaCompile) {
    options.compilerArgs += [ '-Xlint:all', '-Xlint:-path', "-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=mixins.srg" ]
    options.deprecation = true
    options.encoding = 'utf8'
}

compileJava {
    options.compilerArgs += [
        '-Xlint:all',
        '-Xlint:-path',
        '-Xlint:-processing',
        "-AoutSrgFile=${project.mixinSrg.getCanonicalPath()}",
        "-AoutRefMapFile=${project.mixinRefMap.getCanonicalPath()}",
        "-AreobfSrgFile=${project.file('build/srgs/mcp-srg.srg').getCanonicalPath()}"
    ]
    options.deprecation = true
    options.encoding = 'UTF-8'
}

task copySrgs(type: Copy, dependsOn: "genSrgs") {
    // using some FG hacks here
    from plugins.getPlugin("forge").delayedFile("{SRG_DIR}")
    include '**/*.srg'
    into 'build/srgs'
}

reobf {
    reobf.addExtraSrgFile project.mixinSrg
}

I need Forge to be able to access a Forge mod’s API.

You need to be using ForgeGradle 2.0-SNAPSHOT

Now it says there is no forge plugin.

Use net.minecraftforge.gradle.forge as the plugin ID.

After a few additional fixes, it now says Could not find property 'deobfBinJar' on task set.

I’ll look at the way Sponge now applies access transformers to see if I can fix this.

Edit: Looking through the SpongeForge scripts, I can’t find anything to apply access transformers.

I believe ForgeGradle does that for you

That worked, thank you all.

A new problem has arisen. Now I find myself unable to start the server in the development environment. Attempting to do so fails to load any mixins (mixin: null and stacktrace), even with the run configuration generated by ForgeGradle. Afterwards, the server crashes because the mixins failed to load Configurate into the classpath.

You need to clean and refresh your gradle project. Configurate was updated recently and will conflict with older versions.

If using eclipse, you could try gradle cleanEclipse eclipse --refresh-dependencies see if that helps