### Clean Gradle Build Source: https://github.com/darkhax/curseforgegradle/blob/main/examples/local_test_neoforge/README.md Execute this command to reset the build environment. This command does not affect your mod's source code. ```bash gradlew clean ``` -------------------------------- ### TaskPublishCurseForge Configuration Source: https://github.com/darkhax/curseforgegradle/blob/main/README.md Configuration options for publishing artifacts to CurseForge. ```APIDOC ## TaskPublishCurseForge ### Description This task is used to publish artifacts to CurseForge. ### Properties #### apiToken - **apiToken** (String | File | Closure) - Required - The API token used to authenticate with CurseForge. Setting this property is required to use this plugin. #### apiEndpoint - **apiEndpoint** (String | File | Closure) - Optional - The API endpoint to upload the file to. This is the legacy CF API by default, which supports all games on CurseForge. #### debugMode - **debugMode** (Boolean) - Optional - Determines if publishing should actually happen or if the request should just be logged instead. This is an optional property and will default to false. ### Methods #### upload(projectId, file) - **upload(projectId, file)** (String | Number, Object) - Defines a file to upload. The projectId can be a valid numeric String or any valid number. The file can be a file reference, an AbstractArchiveTask, or any other object Gradle can resolve as a file. This returns an UploadArtifact object which can be used to configure the file before publishing it. #### disableVersionDetection() - **disableVersionDetection()** - Invoking this method will disable automatic version detection for all files uploaded by this instance of the task. ``` -------------------------------- ### Read Changelog File with Default Encoding Source: https://github.com/darkhax/curseforgegradle/blob/main/examples/local_test_neoforge/changelog.md A simpler way to read the content of a changelog file using its default text encoding. This is suitable when specific encoding is not a concern. ```gradle file('your/changelog/here').text ``` -------------------------------- ### Refresh Gradle Dependencies Source: https://github.com/darkhax/curseforgegradle/blob/main/examples/local_test_neoforge/README.md Run this command to refresh the local Gradle dependency cache if libraries are missing or issues arise. ```bash gradlew --refresh-dependencies ``` -------------------------------- ### Basic CurseForge Upload Task Source: https://github.com/darkhax/curseforgegradle/blob/main/README.md Define a Gradle task to upload a JAR artifact to CurseForge. It requires your CurseForge API token and project ID, which should be stored securely as environment variables or build secrets. The changelog and game version can be configured for the uploaded artifact. ```groovy task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { // Your auth token for CurseForge. This is like a password, and you should // never share your token with a third party. Store this token in an // environment variable or build secret. apiToken = findProperty('curseforge_token') // The ID of the CurseForge project you want to upload to. def projectId = findProperty('curseforge_project') // Defines the output of the jar task as the file to upload. This returns // an UploadArtifact that can be used to configure things like versions and // the changelog. def mainFile = upload(projectId, jar) mainFile.changelog = 'The changelog string for this file.' mainFile.addGameVersion('1.21.1') } ``` -------------------------------- ### Read Changelog File with UTF-8 Encoding Source: https://github.com/darkhax/curseforgegradle/blob/main/examples/local_test_neoforge/changelog.md Use this method to read the content of a changelog file with specified UTF-8 encoding. Ensure the file exists at the provided path. ```gradle file('your/changelog/here').getText('UTF-8') ``` -------------------------------- ### UploadArtifact Source: https://github.com/darkhax/curseforgegradle/blob/main/README.md Configures the upload of a project artifact to CurseForge, including details about the changelog, release type, and project relationships. ```APIDOC ## UploadArtifact ### Description Configures the upload of a project artifact to CurseForge, including details about the changelog, release type, and project relationships. ### Parameters #### Optional Parameters - **changelog** (String | File | Closure) - Optional - The changelog for the file. - **changelogType** (String | File | Closure) - Optional - The formatting type of the changelog. Accepts plaintext, html, and markdown. Defaults to plaintext. - **displayName** (String | File | Closure) - Optional - An optional display name that will visually replace the file name. Using this method is often discouraged. - **releaseType** (String | File | Closure) - Optional - The type of release you are publishing. Accepts alpha, beta, and release. Defaults to alpha. #### Relationship Parameters - **addIncompatibility**(slugs...) (String | File | Closure, ...) - Optional - Marks the file as being incompatible with the specified project(s). - **addRequirement**(slugs...) (String | File | Closure, ...) - Optional - Marks the file as requiring a file from the specified project(s). - **addEmbedded**(slugs...) (String | File | Closure, ...) - Optional - Marks the file as containing an embedded implementation of another project(s). - **addTool**(slugs...) (String | File | Closure, ...) - Optional - Marks the file as having a tool relation with the specified project(s). - **addOptional**(slugs...) (String | File | Closure, ...) - Optional - Marks the file as having an optional dependency on the specified project(s). - **addModLoader**(modloaders...) (String | File | Closure, ...) - Optional - Adds one or multiple mod loader tags to the file. Known accepted values include Forge, Fabric, and Rift. - **addEnvironment**(environments...) (String | File | Closure, ...) - Optional - Adds one or more environments that the file can run on. Accepted values include Client and Server. - **addJavaVersion**(versions...) (String | File | Closure, ...) - Optional - Marks the file as being compatible with the given Java version(s). - **addGameVersion**(versions...) (String | File | Closure, ...) - Optional - Adds one or multiple game versions to the file. This can only be used on parent files. - **addRelation**(slug, type) (String | File | Closure, String | File | Closure) - Optional - Adds a relationship between the file and another project. - **addRelations**(type, slugs...) (String | File | Closure, String | File | Closure, ...) - Optional - Adds a relationship between the file and multiple other projects. Note: The parameters are in a different order than for addRelation. ``` -------------------------------- ### Configure Java Toolchain for Minecraft Source: https://github.com/darkhax/curseforgegradle/blob/main/README.md Set the Java language version for your project. CurseForgeGradle can use this to determine the appropriate Java version for Minecraft mods. ```groovy java { toolchain { languageVersion = JavaLanguageVersion.of(17) } } ``` -------------------------------- ### Add CurseForgeGradle Plugin Source: https://github.com/darkhax/curseforgegradle/blob/main/README.md Add the CurseForgeGradle plugin to your Gradle project using the plugins DSL. Ensure you replace 'plugin_version_here' with the actual version. ```groovy plugins { id("net.darkhax.curseforgegradle") version "plugin_version_here" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.