{"record":{"id":"51ef5e303d98ac3e","repo":"Anuken/Mindustry","slug":"n-nset-a-build-number-first-n-n","errorCode":null,"errorMessage":"----\\n\\nSET A BUILD NUMBER FIRST!\\n\\n----","messagePattern":"----\\\\n\\\\nSET A BUILD NUMBER FIRST!\\\\n\\\\n----","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build.gradle","lineNumber":510,"sourceCode":"configure([\":core\", \":server\"].collect{project(it)}){\n    java{\n        withJavadocJar()\n        withSourcesJar()\n    }\n\n    publishing{\n        publications{\n            maven(MavenPublication){\n                from components.java\n            }\n        }\n    }\n}\n\ntask deployAll{\n    task cleanDeployOutput{\n        doFirst{\n            if(getBuildVersion() == \"custom build\" || getBuildVersion() == \"\") throw new IllegalArgumentException(\"----\\n\\nSET A BUILD NUMBER FIRST!\\n\\n----\")\n            if(!project.hasProperty(\"release\")) throw new IllegalArgumentException(\"----\\n\\nSET THE RELEASE PROJECT PROPERTY FIRST!\\n\\n----\")\n\n            delete{\n                delete \"deploy/\"\n            }\n        }\n    }\n\n    dependsOn cleanDeployOutput\n    dependsOn \"desktop:packrLinux64\"\n    dependsOn \"desktop:packrWindows64\"\n    dependsOn \"desktop:packrMacOS\"\n    if(versionModifier != \"steam\"){\n        dependsOn \"server:deploy\"\n        dependsOn \"android:deploy\"\n    }\n}\n","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/build.gradle#L492-L528","documentation":"Thrown by the deployAll task's cleanDeployOutput doFirst block when getBuildVersion() returns 'custom build' or an empty string. getBuildVersion (build.gradle:89-92) returns 'custom build' whenever the -Pbuildversion gradle property is absent, so the guard ensures no unversioned build is shipped. The very next line also requires the -Prelease property.","triggerScenarios":"Running 'gradle deployAll' (or any task that depends on it) without passing -Pbuildversion=<number>. Also fires if the property is present but set to an empty string.","commonSituations":"CI forgot to inject the build version property; a developer ran deployAll locally without release flags; a release script regressed and stopped passing -Pbuildversion; the property name was typo'd in the pipeline.","solutions":["Pass the build version explicitly: gradle deployAll -Pbuildversion=146 -Prelease.","In CI, fail the job early if the buildversion property is missing rather than letting deployAll throw.","Cross-check that the same job also sets -Prelease, since the next guard will throw otherwise.","Document the required properties in the release runbook next to the deploy command."],"exampleFix":"// before\ngradle deployAll\n\n// after\ngradle deployAll -Pbuildversion=146 -Prelease","handlingStrategy":"validation","validationCode":"// Before running deployAll, assert the required gradle properties\nif(!project.hasProperty(\"buildversion\") || project.property(\"buildversion\") in [null, \"\", \"custom build\"]){\n    throw new GradleException(\"Pass -Pbuildversion=<number>\");\n}\nif(!project.hasProperty(\"release\")){\n    throw new GradleException(\"Pass -Prelease\");\n}","typeGuard":"static boolean releaseReady(Project p){\n    return p.hasProperty(\"buildversion\") && p.property(\"buildversion\") && p.hasProperty(\"release\");\n}","tryCatchPattern":null,"preventionTips":["Always invoke deployAll with -Pbuildversion=<number> -Prelease.","Make CI fail the job when buildversion is absent instead of letting the task throw.","Keep a release runbook listing the exact gradle command and required properties."],"tags":["build","ci","deployment","gradle"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}