didi/DoKit · error · RuntimeException

执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。

Error message

执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。

What it means

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.

Source

Thrown at Android/build.gradle:171

//        if (!modules.contains("dokit-rpc")) {
//            throw new RuntimeException("未找到dokit-rpc module。。。")
//        }
//
//        if (!modules.contains("dokit-rpc-mc")) {
//            throw new RuntimeException("未找到dokit-rpc-mc module。。。")
//        }

        if (!modules.contains("dokit-plugin")) {
            throw new RuntimeException("未找到dokit-plugin module。。。")
        }
    }
}

task checkUploadConfig4Local() {
    doLast {
        //配置检查
        if (rootProject.ext.publish_config["archives_type"] != 0) {
            throw new RuntimeException("执行当前打包上传任务必须修改config.gradle配置中的archives_type = 0。")
        }
        //仓库检查
        def repositories = new ArrayList<String>()

        rootProject.repositories.forEach {
            if (it instanceof MavenArtifactRepository) {
                repositories.add((it as MavenArtifactRepository).url.toString())
            }
        }

        //相关模块检查
        def modules = new ArrayList<String>()

        rootProject.allprojects.forEach {
            modules.add(it.name)
        }

//        if (!modules.contains("dokit-rpc")) {

View on GitHub (pinned to 626827cddb)

Solutions

  1. Set archives_type = 0 in Android/config.gradle and re-run
  2. Confirm which target you actually want: 0=local, 1=Didi internal, 2=Maven Central
  3. Automate the flag per task (e.g. -Parchives_type or CI parameter) instead of editing config.gradle manually

Example fix

// before (config.gradle)
ext.publish_config = [archives_type: 2, ...]

// after (config.gradle)
ext.publish_config = [archives_type: 0, ...]
Defensive patterns

Strategy: validation

Validate before calling

assert rootProject.ext.publish_config["archives_type"] == 0 : "set archives_type = 0 for local upload"

Prevention

When it happens

Trigger: Running the local upload task while config.gradle has archives_type = 2 (Maven) or 1 (Didi) left over from a previous publishing session.

Common situations: 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.

Related errors


AI-assisted analysis of didi/DoKit@626827cddb (2026-08-14). Data as JSON: /api/errors/23b4d197d52e5758. Report an issue: GitHub.