Skip to main content

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.

warning

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.

note

This is an optional features and will need to be enabled

tip

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:

    features {
usesJarJar = true
}

Including dependencies

To include dependencies you have to add them to the contained configuration of your main source set in your build.gradle:

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.

note

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:

tableau {
jarJar {
usesNoneTransitiveJarJar = 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:

tableau {
jarJar {
extendImplementation = false
}
}