Plugin Docs: Maven - MoreMcmeta/core GitHub Wiki

This page describes how to include MoreMcmeta in a development environment using Maven.

Example Setup

MoreMcmeta uses the Architectury Gradle plugin to support builds for both Forge and Fabric within the same repository. MoreMcmeta's plugin template demonstrates a fairly minimal Gradle setup that uses the Architectury plugin and includes the GitHub Packages Maven repository for MoreMcmeta.

The important bits are in the subprojects and repositories sections of the root build.gradle:

subprojects {
    dependencies {
        // project.name is one of common, forge, fabric
        // moremcmeta_version is the Minecraft and MoreMcmeta versions hyphenated, such as 1.20.1-4.0.0
        // Define moremcmeta_version in gradle.properties in your git repository
        modImplementation "io.github.moremcmeta:moremcmeta-${project.name}:${project.moremcmeta_version}"
        
        // ...
    }
    
    // ...
}

allprojects {
    repositories {
        maven {
            url "https://maven.pkg.github.com/moremcmeta/*/"
            
            // moremcmeta_maven_user is your GitHub username
            // moremcmeta_maven_pass is your GitHub token (see "Authenticate to GitHub Packages")
            // **NEVER** commit tokens to your git repository!
            // Locally, store these in your user Gradle properties: 
            // https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home
            // With GitHub Actions, use secrets and environment variables:
            // https://docs.github.com/en/actions/security-guides/encrypted-secrets
            credentials {
                username System.getenv("MOREMCMETA_MAVEN_USER") ?: project.moremcmeta_maven_user
                password System.getenv("MOREMCMETA_MAVEN_PASS") ?: project.moremcmeta_maven_pass
            }
            
        }

        // ...
    }
    
    // ...
}

// ..

Architectury is not required to use MoreMcmeta. You can include MoreMcmeta in a typical Forge-only or Fabric-only project if you only wish to support one loader, or if you use a different mechanism to support both loaders.

Forge Gradle Default Plugin Deobfuscation

If you're using Forge Gradle, you need to deobfuscate MoreMcmeta's default plugins that are included as jar-in-jars:

dependencies {
    implementation fg.deobf("io.github.moremcmeta:moremcmeta-forge:1.20.1-4.2.3")
    runtimeOnly fg.deobf("io.github.moremcmeta:json-parser-plugin-forge:1.20.1-1.1.0")
    runtimeOnly fg.deobf("io.github.moremcmeta:properties-parser-plugin-forge:1.20.1-1.1.2")
    runtimeOnly fg.deobf("io.github.moremcmeta:animation-plugin-forge:1.20.1-1.0.0")
    runtimeOnly fg.deobf("io.github.moremcmeta:texture-plugin-forge:1.20.1-1.0.0")
    runtimeOnly fg.deobf("io.github.moremcmeta:gui-plugin-forge:1.20.1-1.0.0")
}

Check MoreMcmeta core's build.gradle for the most current list of default plugins and their versions.

GitHub Packages

MoreMcmeta makes official Maven packages available through GitHub Packages. The URL of the Maven repository is https://maven.pkg.github.com/moremcmeta/*/.

There are three packages for the MoreMcmeta API:

  • moremcmeta-common contains code specific to neither Forge nor Fabric
  • moremcmeta-fabric contains common code and Fabric-specific code
  • moremcmeta-forge contains common code and Forge-specific code

Loader-independent subprojects should depend on moremcmeta-common, and the loader-specific subprojects should depend on the corresponding MoreMcmeta package.

Authenticate to GitHub Packages

GitHub Packages requires you to use a GitHub access token to authenticate. On GitHub, you can generate tokens from Settings > Developer settings > Personal access tokens. At minimum, tokens must have the read:packages scope. You can then use the token as the password for the Maven repository.

NEVER commit tokens to your git repository. Once committed and especially once pushed, they are extremely difficult, if not impossible, to remove. Use the user Gradle configuration or GitHub Actions secrets to avoid committing tokens to your repository. Do not store the tokens in your repository's gradle.properties.

Curse Maven

GitHub Packages is the officially-supported way to download MoreMcmeta Maven packages. If you do not want to use GitHub, Curse Maven is an alternative to download them from CurseForge. However, the moremcmeta-common package and sources .jars are not available via CurseForge.

Modrinth Maven

GitHub Packages is the officially-supported way to download MoreMcmeta Maven packages. If you do not want to use GitHub, Modrinth Maven is an alternative to download them from Modrinth. However, the moremcmeta-common package and sources .jars are not available via Modrinth.

Download Jars

You can download .jar files directly from GitHub Packages, including sources .jars and moremcmeta-common. With Gradle, you can include a local directory as a repository.