This guide was created for Forge MDK 39.0.76 but should work for future Forge versions for Minecraft 1.18.x.
- Create a new file in the root folder of your project called
settings.gradle
and add this to it:
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name 'MinecraftForge Maven'
url 'https://maven.minecraftforge.net'
}
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'net.minecraftforge.gradle') {
useModule('net.minecraftforge.gradle:ForgeGradle:5.1.+')
}
}
}
}
- Remove the buildscript block below from
build.gradle
.
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
- Replace it with this:
plugins {
id 'net.minecraftforge.gradle'
id 'eclipse'
id 'maven-publish'
}
That's it, you're now using the plugins DSL.
- The ForgeGradle version cannot be specified in
build.gradle
since it is a changing version, which is not supported by the DSL.