Platforms
Curseforge

Basic example

See the following minimal example showing how to publish the jar task to CurseForge:

publishMods {
    file = jar.archiveFile
    changelog = "Changelog"
    type = STABLE
    modLoaders.add("fabric")
 
    curseforge {
        accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
        projectId = "308769"
        minecraftVersions.add("1.20.1")
        client = true
        server = true
    }
}

CurseForge requires you to declare at least one supported environment. Set client, server, or both.

If you're using an older version of this plugin before 2.0, use clientRequired and/or serverRequired instead. Older plugin versions now need one of those properties set because of CurseForge API changes.

You will need to generate a CurseForge API token in your account settings here (opens in a new tab), you can set this an environment variable. If you plan to publish from your local machine using a Gradle user property may be more convenient:

You can use the gradle property provider like so: providers.gradleProperty('CURSEFORGE_API_KEY')

Multiple projects

You can create multiple CurseForge destinations by providing a name like so:

publishMods {
    curseforge("curseforgeProjectA") {
        // Configure CurseForge settings for project A here
    }
 
    curseforge("curseforgeProjectB") {
        // Configure CurseForge settings for project B here
    }
}

All options

See the following example showing all the CurseForge specific options:

publishMods {
    curseforge {
        accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
        projectId = "123456"
        minecraftVersions.add("1.20.1")
 
        // You can specify a range of Minecraft versions like so:
        minecraftVersionRange {
            start = "1.19.4"
            end = "1.20.2" // Set to "latest" or "latestRelease" to use the latest Minecraft release
        }
 
        // Alternatively, you can specify a range of Minecraft versions as a list:
        minecraftVersionList("26.1, 26.1.1, 26.1.2")
 
        // Optionally set the announcement title used by the discord publisher
        announcementTitle = "Download from CurseForge"
 
        // Optionally specify the java version that is required to run the mod
        javaVersions.add(JavaVersion.VERSION_17)
 
        // CurseForge requires at least one supported environment
        client = true
        server = true
 
        // When using the discord webhook you must also specify the project slug
        // This is due to limitations in the CurseForge API.
        projectSlug = "test-mod"
 
        // Add dependencies to your project
        requires("project-slug-1", "another-project")
        optional("project-slug")
        incompatible("project-slug")
        embeds("project-slug")
 
        // Set a changelog using text, markdown, or html (defaults to markdown)
        changelog = "# Markdown changelog content"
        changelogType = "markdown"
 
        // Set the display name of an additional file
        additionalFile(jar) {
            name = "Fabric"
        }
 
        // Set the display name of an additional file from another project
        additionalFile(project(":child")) {
            name = "Fabric"
        }
    }
}