Including dependencies in the mod JAR
When you build a mod, you can include dependencies in the mod JAR file. This is useful when you want to distribute your mod as a single JAR file.
Including 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.
This is an optional features and will need to be enabled
The jarjar module is mutually exclusive with the shadow module. You can only use one of them at a time.
Enabling Jar-in-Jar
As this feature is optional, and a different distribution method can be used (like shadowing), you will need to enable it in your settings
file:
- Groovy
- Kotlin
features {
usesJarJar = true
}
features {
usesJarJar.set(true)
}
Including dependencies
To include dependencies you have to add them to the contained
configuration of your main
source set in your build.gradle:
- Groovy
- Kotlin
tableau {
sourceSets {
main {
contained "com.google.guava:guava:30.1-jre"
}
}
}
tableau {
sourceSets {
main {
contained("com.google.guava:guava:30.1-jre")
}
}
}
This will include the Guava library in your mod JAR file as a JAR-in-JAR dependency.
We highly recommend using version ranges and version catalogs to manage your dependencies.
Include transitive dependencies
By default, only the direct dependencies are included in the mod JAR file. If you want to include transitive dependencies, you can set the usesNoneTransitiveJarJar
parameter to false:
- Groovy
- Kotlin
tableau {
jarJar {
usesNoneTransitiveJarJar = false
}
}
tableau {
jarJar {
usesNoneTransitiveJarJar.set(false)
}
}
This will include all transitive dependencies of the direct dependencies in the mod JAR file.
Implementation extension
By default, all dependencies added to the contained configuration are treated as implementation
dependencies.
If you want to disable this behavior, you can set the extendImplementation
parameter to false:
- Groovy
- Kotlin
tableau {
jarJar {
extendImplementation = false
}
}
tableau {
jarJar {
extendImplementation.set(false)
}