import org.gradle.api.JavaVersion
import org.gradle.api.GradleException

pluginManagement {
    repositories {
        // 国内镜像：Gradle 插件（含 org.jetbrains.intellij 等，同步自 Gradle Plugin Portal）
        maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
        gradlePluginPortal()
        mavenCentral()
    }
}

// org.jetbrains.intellij 插件 1.17.x 的构件声明为 Java 11+；用 Java 8 跑 Gradle 会报 “compatible with Java 8” 类错误
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11)) {
    throw GradleException(
        "Idea-Plugin 需要 JDK 11+ 运行 Gradle（当前 JVM: ${System.getProperty("java.version")}）。\n" +
            "IntelliJ IDEA: Settings → Build, Execution, Deployment → Build Tools → Gradle → Gradle JVM → 选 17。\n" +
            "命令行: 将 JAVA_HOME 设为 JDK 17 后再执行 gradlew。"
    )
}

rootProject.name = "Huangzhijun-Idea-Plugin"
