{"record":{"id":"23b4d197d52e5758","repo":"didi/DoKit","slug":"config-gradle-archives-type-0","errorCode":null,"errorMessage":"执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。","messagePattern":"执行当前打包上传任务必须修改config\\.gradle配置中的archives_type = 0。","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"Android/build.gradle","lineNumber":171,"sourceCode":"//        if (!modules.contains(\"dokit-rpc\")) {\n//            throw new RuntimeException(\"未找到dokit-rpc module。。。\")\n//        }\n//\n//        if (!modules.contains(\"dokit-rpc-mc\")) {\n//            throw new RuntimeException(\"未找到dokit-rpc-mc module。。。\")\n//        }\n\n        if (!modules.contains(\"dokit-plugin\")) {\n            throw new RuntimeException(\"未找到dokit-plugin module。。。\")\n        }\n    }\n}\n\ntask checkUploadConfig4Local() {\n    doLast {\n        //配置检查\n        if (rootProject.ext.publish_config[\"archives_type\"] != 0) {\n            throw new RuntimeException(\"执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。\")\n        }\n        //仓库检查\n        def repositories = new ArrayList<String>()\n\n        rootProject.repositories.forEach {\n            if (it instanceof MavenArtifactRepository) {\n                repositories.add((it as MavenArtifactRepository).url.toString())\n            }\n        }\n\n        //相关模块检查\n        def modules = new ArrayList<String>()\n\n        rootProject.allprojects.forEach {\n            modules.add(it.name)\n        }\n\n//        if (!modules.contains(\"dokit-rpc\")) {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/build.gradle#L153-L189","documentation":"The checkUploadConfig4Local Gradle task in Android/build.gradle throws a RuntimeException when rootProject.ext.publish_config['archives_type'] != 0. It guards the local-Maven publishing path, asserting config.gradle is set to archives_type = 0 (publish to local repository) before the local upload runs.","triggerScenarios":"Running the local upload task while config.gradle has archives_type = 2 (Maven) or 1 (Didi) left over from a previous publishing session.","commonSituations":"Switching between upload targets during a release day and forgetting to flip the flag; a teammate's committed config.gradle carrying a different archives_type than the task you run.","solutions":["Set archives_type = 0 in Android/config.gradle and re-run","Confirm which target you actually want: 0=local, 1=Didi internal, 2=Maven Central","Automate the flag per task (e.g. -Parchives_type or CI parameter) instead of editing config.gradle manually"],"exampleFix":"// before (config.gradle)\next.publish_config = [archives_type: 2, ...]\n\n// after (config.gradle)\next.publish_config = [archives_type: 0, ...]","handlingStrategy":"validation","validationCode":"assert rootProject.ext.publish_config[\"archives_type\"] == 0 : \"set archives_type = 0 for local upload\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Maintain a release checklist mapping target -> archives_type (0 local, 1 Didi, 2 Maven)","Parameterize archives_type in CI instead of hand-editing config.gradle"],"tags":["gradle","build-config","publishing","local-maven"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}