Quick build
To build all mod variants (Fabric and NeoForge):build/libs/fabric-21.1/- Fabric buildbuild/libs/neoforge-21.1/- NeoForge build
The version number is set in
build.gradle.kts as version = "0.6+indev"Building specific loaders
You can build for a specific mod loader to save time:- Fabric
- NeoForge
Build only the Fabric version:Output:
build/libs/fabric-21.1/regions_unexplored-fabric-21.1-0.6+indev.jarBuild tasks
clean
clean
Remove all build artifacts:Use this when you want a fresh build or are experiencing caching issues.
build
build
Compile code, run tests, and create JAR files:This is the standard build command that produces distributable JARs.
assemble
assemble
Create JARs without running tests:Faster than
build when you don’t need to run tests.jar
jar
Build JAR files for all targets:Equivalent to
assemble for this project.runData
runData
Generate worldgen data files:Generated files are placed in
src/shared/21.1/main/generated/Build output structure
After running./gradlew build, your build directory will contain:
Clean builds
For a completely clean build (recommended before releases):JAR file contents
Each built JAR contains:- Code
- Resources
- Metadata
- Compiled Java classes from
common/and loader-specific modules - Mixin configurations
- Access widener definitions
Version management
The mod version is defined inbuild.gradle.kts:
Follow semantic versioning (MAJOR.MINOR.PATCH) for release versions.
Testing builds
Before distributing, test your builds:- Development Environment
- Production Environment
- Server Testing
Test in the development environment first:
Build optimization
Parallel builds
The project is configured for parallel builds ingradle.properties:
Build cache
Enable Gradle’s build cache for faster rebuilds:~/.gradle/gradle.properties:
Daemon
The Gradle daemon keeps Gradle running in the background for faster builds. It’s enabled by default. To stop the daemon:Troubleshooting
Out of memory during build
Out of memory during build
Increase the Gradle JVM memory in The default is 4GB, but complex builds may need more.
gradle.properties:Build fails with 'Task not found'
Build fails with 'Task not found'
Ensure you’re using the correct task path:The version number (21.1) is required in the task path.
JAR is missing resources
JAR is missing resources
Verify resources are in the correct locations:
- Assets:
src/common/main/resources/assets/ - Data:
src/common/main/resources/data/ - Generated:
src/shared/21.1/main/generated/
./gradlew clean build for a fresh build.Gradle wrapper not found
Gradle wrapper not found
If On Windows, use
./gradlew doesn’t work, ensure the wrapper is executable:gradlew.bat instead.Dependency resolution fails
Dependency resolution fails
Clear Gradle’s cache and retry:
Publishing
When ready to publish your build:Upload to platforms
Upload the JAR files to:
- Modrinth
- CurseForge
- GitHub Releases
Next steps
Getting started
Learn how to set up your development environment
Project structure
Understand the codebase organization