Skip to content

Latest commit

 

History

History
137 lines (108 loc) · 3.11 KB

File metadata and controls

137 lines (108 loc) · 3.11 KB

插件兼容性说明

当前版本要求

  • 最低支持版本: IntelliJ IDEA 2025.1 (build 251)
  • 编译版本: IntelliJ IDEA 2025.1

版本号对应关系

Build 号 IDEA 版本
251 2025.1
241 2024.1
232 2023.2
231 2023.1
222 2022.2
221 2022.1
213 2021.3

如何支持更低版本的 IDEA

方法一:修改 build.gradle.kts(推荐)

  1. 修改编译版本(如果需要)

    dependencies {
        intellijPlatform {
            create("IC", "2023.2")  // 改为目标版本
            // ...
        }
    }
  2. 修改最低支持版本

    intellijPlatform {
        pluginConfiguration {
            ideaVersion {
                sinceBuild = "232"  // 改为 2023.2
                // 可选:设置最高支持版本
                // untilBuild = "241.*"
            }
        }
    }

方法二:支持多个版本范围

intellijPlatform {
    pluginConfiguration {
        ideaVersion {
            sinceBuild = "222"      // 最低支持 2022.2
            untilBuild = "241.*"   // 最高支持 2024.1
        }
    }
}

代码兼容性检查

当前代码使用的 API:

✅ 兼容性较好的 API(支持较老版本)

  • ModuleManager - 自 IDEA 早期版本就存在
  • ModuleRootManager - 自 IDEA 早期版本就存在
  • VirtualFile - 自 IDEA 早期版本就存在
  • DialogWrapper - 自 IDEA 早期版本就存在

⚠️ 可能需要调整的 API

  • WriteAction - 在较老版本中可能需要使用 ApplicationManager.getApplication().runWriteAction()

降级到 2023.2 的示例配置

dependencies {
    intellijPlatform {
        create("IC", "2023.2")  // 改为 2023.2
        testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
        bundledPlugin("com.intellij.java")
    }
}

intellijPlatform {
    pluginConfiguration {
        ideaVersion {
            sinceBuild = "232"  // 2023.2
        }
    }
}

降级到 2022.2 的示例配置

dependencies {
    intellijPlatform {
        create("IC", "2022.2")  // 改为 2022.2
        testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
        bundledPlugin("com.intellij.java")
    }
}

intellijPlatform {
    pluginConfiguration {
        ideaVersion {
            sinceBuild = "222"  // 2022.2
        }
    }
}

注意事项

  1. Java 版本要求

    • IDEA 2022.2+ 要求 Java 17+
    • 如果支持更老版本,可能需要调整 Java 版本
  2. API 兼容性

    • 降级后需要测试所有功能
    • 某些新 API 在旧版本中可能不可用
  3. 测试建议

    • 在目标版本中运行 ./gradlew runIde 进行测试
    • 检查所有功能是否正常工作

推荐的兼容性策略

  1. 保守策略:支持最近 2-3 个主要版本

    • 例如:支持 2023.2, 2024.1, 2025.1
  2. 广泛兼容:支持更多版本

    • 例如:支持 2022.2 到最新版本
  3. 最新优先:只支持最新版本

    • 当前策略:只支持 2025.1+