A pure-blooded Java tool to generate a maven repository for Minecraft artifacts.
Due to Minecraft being closed source, and (previously) obfusicated it can not be used directly as a library in the form that Mojang releases it. This is designed to be a stand alone tool that will generate a directory that is suitable to be used as a maven respository containing Minecraft related artifacts. The basic conept is to replace the hacks into Gradle's internals that our ForgeGradle tool was reqired to do. In doing so disconnects the core functionality from Gradle, allowing it to be more stable considering how much Gradle likes to change its 'best practices'.
This tool is designed as a executable jar, not a library that can be referenced by other java code. As such the only 'public api' is the command line arguments. As such anything that can call a executable jar, should be able to use this. Opening the possibility for usage in other build systems such as maven. This is not tested, and may need additional changes. If people want to use this tool in other build systems. Please feel encouraged to file an issue or pull request.
- Functional:
- MCPConfig based artifacts: Vanilla Minecraft (1.12.2+)
- UserDev3+ Forge libraries, these are versions of Forge that use ForgeGradle 3+ (Minecraft 1.13+, and some builds of 1.12.2)
- Parchment and Official mappings.
- TODO:
- Legacy Forge versions.
- Forge Gradle has gone through many eras, and before that we had a python based build system. It will take some time but the plan is to eventually support every version of Forge that has been released.
- Support Artifact Transformers allowing ModLauncher/Mixin/Whatever to apply static transformation of artifacts? Probably not needed.
- Deobfuscating arbitrary dependencies. Basically a replacement for
fg.deobfallowing mods to be used in different mappings then they are released. - Better cacheing management, and debug information on cache misses.
- Legacy Forge versions.
Minecraft Mavenizer is a standalone Java tool that can be invoked through the command line. Here is an example:
java -jar minecraft-maven.jar --version 1.21.3-53.0.25As Forge is the main target of this tool, that is all you need to generate the Forge artifacts.
Warning
There is no public API for this tool! This is designed to solely be a CLI tool, which means that all of the implementations are internal. We reserve the right to change the internal implementation at any time.
Mavenizer is seperated into multiple tasks specified by the --maven, --mcp, and --mcp_data command line arguments.
The only task consumers should care about is the --maven task, and thus is the default if those arguments are omitted. And the only one I'm going to document here. The others are used in ForgeDev, our plugin for making Forge itself.
| Argument | Default | Description |
|---|---|---|
--version String |
The specific artifact version to generate. This is the only required argument. | |
--artifact String |
net.minecraftforge:forge |
The artifact to generate. |
| --client | Shorthand for --artifact net.minecraft:client |
|
| --server | Shorthand for --artifact net.minecraft:server |
|
| --forge | Shorthand for --artifact net.minecraftforge:forge |
|
| --mapping-data | Shorthand for --artifact net.minecraft:mappings |
|
| --mc | Shorthand for --artifact net.minecraft:joined |
|
--mappings String |
official |
Mappings to use for this artifact. Formatted as channel:version. If version is missing, will attempt use the detected minecraft version of the artifact. |
--parchment version |
Version of parchment mappings to use, snapshots are not supported. Shorthand for --mappings parchment:version |
|
--output File |
./output |
Root directory to generate the maven repository. |
--cache File |
./cache |
The directory to use for caching things used for building. |
--jdk-cache File |
./cache/jdks |
Directory to store jdks downloaded from the disco api. |
| --cache-only | Only use caches, fail if any downloads need to occur or if a task needs to do work. | |
| --offline | Allows offline operations, fails if any downloads need to occur. | |
| --dependencies-only | Outputs the maven containing only the Gradle Module and POM for the artifact's dependencies without outputting the artifact itself | |
| --global-auxiliary-variants | Declares sources and javadoc jars as global variants, no matter the mapping version. This is used to work around gradle/gradle#35065 | |
--repository String |
EXPERIMENTAL: URL of a foreign maven repository to use for dependencies. The format is name,url. The name must not include any commas. |
Supported Artifacts:
net.minecraftfroge:forgenet.minecraft:clientnet.minecraft:client-extranet.minecraft:servernet.minecraft:server-extranet.minecraft:joinednet.minecraft:joined-extranet.minecraft:mappings
Supported Mapping Channels:
official: Official mappings provided by Mojang, located by the launcher's version.json file. Only available for versions Mojang has released the mappings for.notch: Also known as obfusicated, the raw names of the class as Mojang released them. Note: Mojang is intending to remove obfusication, so for versions that don't have obf,notchwill not be supported.srgorsearge: The intermediate names used by MCPConfig to make the code readable. One step abovenotch.parchment: A layer over theofficialmappings that add parameter names, and javadoc. See https://parchmentmc.org/
For all artifacts, the standard maven pom file is generated with appropriate dependencies.
For artifacts that support mappings, we also generate a Gradle Module File to specify the mapping specific variants.
side-version.pom: Maven metadata pom file containing all dependencies.side-version-metadata.zip: A zip file containing metadata about this artifact. It currently only has 2 files in it. version.properties, which containedversion=1to know what format this zip is in. Andversion.jsonwhich is the version.json file from the Minecraft launcher.side-version.jar: The main archive for this artifact. This supports mappings, as such specific versions are referenced in the module file.side-version-sources.jar: The sources for this artifact. Not available fornotch,srg,seargemappings. This supports mappings, as such specific versions are referenced in the module file.
side-version.jar: This is a legacy file that houses all theextradata in the vanilla Minecraft jars. The server typically doesn't have anything in it anymore. But it used to have all the dependency libraries when Mojang released the Server jar as a normaluberjar. The client contains all the non-class file entries. Such as images, sounds, language files that may be in the Client vanilla jar file.
mappings-version.jar: A archive containing csv files mapping SRG intermediate names to the specified mapping. This is mainly intended for old versions which use SRG at runtime, and need to runtime remap reflection to mapped names.
Currently only UserDev3 files are supported.
Generating this artifact will automatically generate the appropriate net.minecraft:client-extra, and net.minecraft:mappings artifacts.
forge-version.jar: Main artifact, contains classes and a data for the game. This supports mappings, as such specific versions are referenced in the module file.forge-version-sources.jar: The sources for this artifact. This supports mappings, as such specific versions are referenced in the module file.forge-version-metadata.zip: A metadata zip containing information useful for ForgeGradle. Currently contains:version.properties: A text file containingversion=1, This will allow us to change the format of files in this archive if needed.runs.json: Run configuration information from Userdev's config. Useful for SlimeLauncher to actually launch the game.version.json: The version.json file from the Minecraft launcher.