Shadowing dependencies into the mod JAR
When you build a mod, you can shadow dependencies in the mod JAR file. This is useful when you want to distribute your mod as a single JAR file. This example will show how to include a version of guava, but you can pick any dependency you want.
warning
Shadowing dependencies is only supported in the main primary jar, we are working on a more complete publication system that supports an arbitrary combination of jars.
Setting up Jar-in-Jar
- Groovy
- Kotlin
settings.gradle
features {
usesShadowing = true
}
settings.gradle.kts
features {
usesShadowing.set(true)
}
Including dependencies
- Groovy
- Kotlin
tableau {
mod {
// Mod information
modid = 'modid' // Use your own modid here.
group = 'com.example' // Use your own group here.
minecraftVersion = '1.21.3' // Or any other minecraft version.
publisher = 'SomePublisher' // Use your own name here.
url = 'https://github.com/someorg/modid' // Use your own URL here.
}
sourceSets {
main {
contained "com.google.guava:guava:30.1-jre"
}
}
}
tableau {
mod {
// Mod information
modid.set("modid") // Use your own modid here.
group.set("com.example") // Use your own group here.
minecraftVersion.set("1.21.3") // Or any other minecraft version.
publisher.set("SomePublisher") // Use your own name here.
url.set("https://github.com/someorg/modid") // Use your own URL here.
}
sourceSets {
main {
contained("com.google.guava:guava:30.1-jre")
}
}
}
note
You can find a full example of this project configuration in the Shadowing Example on GitHub.