Jar-in-Jar is a way to handle the dependencies of your mod.
Jar-in-Jar is a way to handle the dependencies of your mod.
Sometimes these are libraries pulled from a central maven repository, sometimes these are libraries specially designed for Minecraft and sometimes these are completely other mods.
Sometimes these are libraries pulled from a central maven repository, sometimes these are libraries specially designed for Minecraft and sometimes these are completely other mods.
−
Whatever the reason for using a library during the development of your mods, you will need to ensure that the end user has them available when he runs your mod in his environment.
+
Whatever the reason for using a library during the development of your mods, you will need to ensure that the end user has them available when someone runs your mod in their environment.
Although there are several options available to achieve this, including for example the Shading plugin, this does not work all the time and can even cause problems along the way when for example two mods need the same dependency.
Although there are several options available to achieve this, including for example the Shading plugin, this does not work all the time and can even cause problems along the way when for example two mods need the same dependency.
Introducing the all-new, all-shiny: Jar-In-Jar.
Introducing the all-new, all-shiny: Jar-In-Jar.
+
====Central function====
====Central function====
Jar-In-Jar is first and foremost a way to load dependencies for mods, from the jars of the mods.
Jar-In-Jar is first and foremost a way to load dependencies for mods, from the jars of the mods.
−
To achieve this it looks for a file called: ''META-INF/jarjar/metadata.json''. If you are interested in the format of this file, see the following section of the JarJar library which we expose: [https://github.com/MinecraftForge/JarJar/tree/main/src/main/java/net/minecraftforge/jarjar/metadata JarJar Library - Metadata Source]
+
To achieve this it looks for a file called: ''META-INF/jarjar/metadata.json''. If you are interested in the format of this file, see the following section of the JarJar library which we expose: [https://github.com/MinecraftForge/JarJar/tree/main/metadata/src/main/java/net/minecraftforge/jarjar/metadata JarJar Library - Metadata Source]
In short, this metadata file lists a set of dependencies to include, what their maven coordinate is, the accepted version range that your mod supports, the version of the dependency that is included in your mods jar as well as a path to the jar in your mods jar file.
In short, this metadata file lists a set of dependencies to include, what their maven coordinate is, the accepted version range that your mod supports, the version of the dependency that is included in your mods jar as well as a path to the jar in your mods jar file.