Gradle build failure: Could not resolve dev.architectury:architectury-pack200:0.1.3 - Java compatibility issue

I am building a Gradle project which is a mod for minecraft version 1.8.

It is of note that when I first built this project I imported it into IntelliJ as a regular project, and it built fine, so I assume there is an issue with some setting somewhere. I also know other developers that have successfully used Architectury in 1.8.9 mods, but they could not offer me a fix.

build.gradle.kts file is pasted after the exception.

    FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Bot Mod'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve dev.architectury:architectury-pack200:0.1.3.
     Required by:
         project : > dev.architectury.architectury-pack200:dev.architectury.architectury-pack200.gradle.plugin:0.1.3
      > No matching variant of dev.architectury:architectury-pack200:0.1.3 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.2' but:
          - Variant 'apiElements' capability dev.architectury:architectury-pack200:0.1.3 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 16 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.2')
          - Variant 'runtimeElements' capability dev.architectury:architectury-pack200:0.1.3 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 16 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.2')
          - Variant 'sourcesElements' capability dev.architectury:architectury-pack200:0.1.3 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.2')

build.gradle.kts file is here:

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import dev.architectury.pack200.java.Pack200Adapter

plugins {
    kotlin("jvm") version ("1.6.21")
    id("com.github.johnrengelman.shadow") version("7.1.2")
    id("dev.architectury.architectury-pack200") version ("0.1.3")
    id("net.kyori.blossom") version("1.3.0")
    id("gg.essential.loom") version ("0.10.0.+")
    java
}

val projectName: String by project
val projectId: String by project
val projectVersion: String by project
val projectGroup: String by project

version = projectVersion
group = projectGroup
base.archivesName.set("${projectName}")

blossom {
    replaceToken("@VERSION@", projectVersion)
    replaceToken("@NAME@", projectName)
    replaceToken("@ID@", projectId)
}

loom {
    launchConfigs {
        getByName("client") {
            property("fml.coreMods.load", "${projectGroup}.forge.FMLTweaker")
            arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
            arg("--mixin", "mixins.${projectId}.json")
        }
    }

    runConfigs {
        getByName("client") {
            isIdeConfigGenerated = true
        }
    }

    forge {
        pack200Provider.set(Pack200Adapter())
        mixinConfig("mixins.${projectId}.json")
    }

    mixin {
        defaultRefmapName.set("mixins.${projectId}.refmap.json");
    }
}

val shade by configurations.creating
configurations.implementation.get().extendsFrom(shade)

repositories {
    mavenCentral()
    maven ("https://repo.spongepowered.org/repository/maven-public/")
}

dependencies {
    minecraft("com.mojang:minecraft:1.8.9")
    mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
    forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")

    shade("org.spongepowered:mixin:0.7.11-SNAPSHOT")
}

tasks {
    processResources {
        inputs.property("version", projectVersion)
        inputs.property("mcversion", "1.8.9")
        inputs.property("name", projectName)
        inputs.property("id", projectId)

        filesMatching("mcmod.info") {
            expand(
                "id" to projectId,
                "name" to projectName,
                "version" to projectVersion,
                "mcversion" to "1.8.9"
            )
        }

        filesMatching("mixins.${projectId}.json") {
            expand(
                "id" to projectId
            )
        }
    }

    named<ShadowJar>("shadowJar") {
        archiveClassifier.set("dev")
        configurations = listOf(shade)
        duplicatesStrategy = DuplicatesStrategy.EXCLUDE
        mergeServiceFiles()
    }
    withType<JavaCompile> {
        options.encoding = "UTF-8"
    }
    remapJar {
        input.set(shadowJar.get().archiveFile)
        archiveClassifier.set("")
    }

    named<Jar>("jar") {
        archiveBaseName.set(projectName)
        duplicatesStrategy = DuplicatesStrategy.EXCLUDE
        manifest.attributes(
            "FMLCorePlugin" to "${projectGroup}.forge.FMLTweaker",
            "ModSide" to "CLIENT",
            "ModType" to "FML",
            "FMLCorePluginContainsFMLMod" to true,
            "ForceLoadAsMod" to true,
            "TweakClass" to "org.spongepowered.asm.launch.MixinTweaker",
            "TweakOrder" to "0",
            "MixinConfigs" to "mixins.${projectId}.json",
        )
    }
}

kotlin {
    jvmToolchain {
        check(this is JavaToolchainSpec)
        languageVersion.set(JavaLanguageVersion.of(8)) 
    }

}
  • My JAVA_HOME variable is set to “jre1.8.0_202”
  • IntelliJ SDK set to 1.8
  • Language level set to 8
  • Gradle distribution is wrapper
  • Gradle JVM is 16.
  • Java language version set to 8 inside the build.gradle.kts file

I have tried playing around with the versions/levels of the following variables, all resulting in the same issue. I have also tried clearing IntelliJ cache and restarting it.

And any other solutions I did not list but were in this thread: “gradle - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 10 - Stack Overflow

Your “* Gradle JVM is 16.” point is wrong.
The error says that you use a plugin that requires that you at least use Java 16 to run Gradle, but you are using Java 8 to run Gradle.

The jvm for gradle is set to 16 in intelliJ settings

Well, your error objects to that.
How do you run the build?
Can you share a build --scan?