Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
Jasmine Iwanek edited this page Jun 26, 2021 · 14 revisions

Welcome to the CurseGradle wiki!

External Links

Basic Buildscript

To find out which versions are available, check HERE.

plugins {
  id 'com.matthewprenger.cursegradle' version '<VERSION>'
}

curseforge {
  apiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
  project {
    id = '12345'
    changelog = 'Some changes'
    releaseType = 'alpha'
    addGameVersion '1.12.2'

    mainArtifact(jar) {
      displayName = "MyMod version: $project.version"
    }
  }
}

The curseforge { } section

The curseforge { } block of your build.gradle is where you define all your settings for CurseGradle. Multiple projects can be defined if you have multiple projects in the same gradle workspace. Example:

curseforge {
  project {
    id = '123'
  }
  project {
    id = '456'
  }
}

Each project will get it's own task called: curseforge<id> (curseforge123 and curseforge456 in this example) that will only upload that project. The main task added by this plugin is the curseforge task. It will upload all defined projects.

All the possibilities

Artifacts

Any argument below that takes an artifact, that would be mainArtifact and addArtifact currently, can be customized individually. Each artifact can have the following properties defined:

  • changelogType: The type of changelog. This can be: text, html, or markdown. The default is text.
  • changelog: A list of changes for the current build. This can be a String or a File. If a file is set, its contents will be used. This is a required field.
  • displayName: A user-friendly display name for the artifact. This can be a String or a File. If a file is specified, its contents will be used.
  • releaseType: One of alpha, beta, or release. This tells end users how stable the file is. Once again, a file can be specified if you so desire. This is a required field.
  • relations: Dependencies, incompatibilities, or relationships with other projects on CurseForge. This can also be specified on the project level. To get the project's unique slug, look in the URL on CurseForge Example: Railcraft: http://minecraft.curseforge.com/mc-mods/railcraft, the slug is railcraft.
curseforge {
  project {
    mainArtifact(jar) {
      relations {
        requiredDependency 'railcraft' // Railcraft is required
        embeddedLibrary 'cofhlib' // CoFH Lib is shipped with the artifact
        optionalDependency 'notenoughitems' // Not Enough Items is an optional addon
        tool 'worldedit' // World Edit is a compatible tool
        incompatible 'buildcraft' // BuildCraft is not compatible
      }
    }
  }
}

All of the above properties, with the exception of displayName can also be set in the project { } block and it will apply to all artifacts of the project that don't override it.

curseforge {
  project {
    releaseType = 'beta'
    changelogType = 'html'
    changelog = '<h2>Big Changes!</h2>'
    relations {
      requiredDependency 'railcraft'
    }
  }
}

Project Settings

apiKey - Required

This can be applied globally:

curseforge {
  apiKey = '...'
}

or per project if you have multiple projects with different API keys:

curseforge {
  project {
    apiKey = '123456'
  }
  project {
    apiKey = '456789'
  }
}

id - Required

The project ID on CurseForge. This is the numerical part of the URL.

curseforge {
  project {
    id = '12345'  
  }
}

mainArtifact - Required

The main artifact is applied per project and should be the primary binary produced by the build. Although this is a required field, it can be left out if the java gradle plugin is applied. If so, the java jar task will be selected automatically.

curseforge {
  project {
    mainArtifact jar
  }
}

addGameVersion - Required

Add a version of Minecraft that is compatible with this upload. If ForgeGradle is applied, this field can be left out and will be pulled from ForgeGradle.

curseforge {
  project {
    addGameVersion '1.12.2'
  }
}

addArtifact

Additional artifacts can be uploaded in addition to the primary mainArtifact

curseforge {
  project {
    addArtifact sourcesJar
  }
}

Options

Additional options to control integration with other features can be controlled in the options section.

curseforge {
  project {
    //...
  }
  options {
    debug = false // defaults to false
    javaVersionAutoDetect = true // defaults to true
    detectNewerJava = false // defaults to false
    javaIntegration = true // defaults to true
    forgeGradleIntegration = true // defaults to true
  }
}

debug

Debug mode will stop just short of actually uploading the file to Curse, and instead spit out the JSON to the console. Useful for testing your buildscript.

curseforge {
  project {
    //...
  }
  options {
    debug = true // defaults to false
  }
}

javaVersionAutoDetect

If this is left enabled, CurseGradle will automatically detect the compatible versions of Java for the project and add them to the CurseForge metadata.

curseforge {
  project {
    //...
  }
  options {
    javaVersionAutoDetect = false // defaults to true
  }
}

detectNewerJava

If this is enabled, CurseGradle will detect Java 9 and later versions of Java for the project and add them to the CurseForge metadata.

curseforge {
  project {
    //...
  }
  options {
    detectNewerJava = true // defaults to false
  }
}

javaIntegration

Enable integration with the Gradle Java plugin. This includes setting the default artifact to the jar task.

curseforge {
  project {
    //...
  }
  options {
    javaIntegration = false // defaults to true
  }
}

forgeGradleIntegration

Enable integration with the ForgeGradle plugin. This includes setting dependencies on the reobfuscation tasks. Set this to false to disable automatic rebuild, e.g. if you want to push the same artifact to multiple destinations (GitHub releases, ...).

curseforge {
  project {
    //...
  }
  options {
    forgeGradleIntegration = false // defaults to true
  }
}