TheMrMilchmann / gradle-curseforge-publish

A Gradle plugin that provides support for publishing artifacts to CurseForge.
https://plugins.gradle.org/plugin/io.github.themrmilchmann.curseforge-publish
MIT License
4 stars 0 forks source link

Cannot query the value of property 'projectId' because it has no value available. #52

Closed NyakoFox closed 1 week ago

NyakoFox commented 1 week ago

My configuration is as follows:

curseforge {
    apiToken = env.CURSEFORGE_TOKEN.value
    publications {
        register("curseForge") {
            projectId = "570109"

            artifacts.register("main") {
                from(tasks.named("remapJar"))

                displayName = "VanitySlots 2.0.0+1.21.1"

                changelog {
                    content = file('../CHANGELOG.md').text
                }

                relations {
                    requiredDependency("fabric-api")
                    requiredDependency("accessories")
                    requiredDependency("forge-config-api-port-fabric")
                    optionalDependency("modmenu")
                }
            }
        }
    }
}

I'm doing a multiloader setup, so this is the fabric build.gradle. I have a slightly modified version in NeoForge's build.gradle, and that works fine, however the Fabric one doesn't, despite the projectId line being the same. My repo is here if you'd like to take a closer look.

TheMrMilchmann commented 1 week ago

Cannot query the value of property 'projectId' because it has no value available.

This is usually an indication of a publication that's not configured. In your particular case, this happens because you are registering a new publication even though a publication is preregistered for Fabric.

You can fix this issue by applying the following changes:

diff --git a/fabric/build.gradle b/fabric/build.gradle
index 20cbb20..0b9934e 100644
--- a/fabric/build.gradle
+++ b/fabric/build.gradle
@@ -8,12 +8,10 @@ plugins {
 curseforge {
     apiToken = env.CURSEFORGE_TOKEN.value
     publications {
-        register("curseForge") {
+        named("fabric") {
             projectId = "570109"

-            artifacts.register("main") {
-                from(tasks.named("remapJar"))
-
+            artifacts.named("main") {
                 displayName = "VanitySlots (Fabric) 2.0.0+1.21.1"

                 changelog {

Note that there is no automatically registered publication for the NeoForge Gradle plugin (ModDevGradle) you are using. This will be added in 0.7.0.

NyakoFox commented 1 week ago

Ah, thank you so much!