Skip to content

Commit dc45b89

Browse files
committed
ci: inline CI env check inside repositories block to satisfy Gradle 9 settings ordering
1 parent aa8e6ab commit dc45b89

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

settings.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// CI 环境(如 GitHub Actions 设置 CI=true)跳过国内 aliyun 镜像,
22
// 直接使用 mavenCentral / google / gradlePluginPortal,避免镜像 5xx 把整个仓库 disable。
3-
def useAliyunMirror = System.getenv("CI") == null
4-
3+
// 注意:Gradle 9 要求 pluginManagement {} 必须是 settings.gradle 的第一个语句,
4+
// 不能在它之前声明任何变量/语句,因此这里在每个 repositories 块内联读取 env。
55
pluginManagement {
66
repositories {
77
google()
88
gradlePluginPortal()
99
mavenCentral()
10-
if (useAliyunMirror) {
10+
if (System.getenv("CI") == null) {
1111
maven { url "https://maven.aliyun.com/repository/public" }
1212
maven { url "https://maven.aliyun.com/repository/google" }
1313
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
@@ -25,7 +25,7 @@ dependencyResolutionManagement {
2525
repositories {
2626
google()
2727
mavenCentral()
28-
if (useAliyunMirror) {
28+
if (System.getenv("CI") == null) {
2929
maven { url "https://maven.aliyun.com/repository/public" }
3030
maven { url "https://maven.aliyun.com/repository/google" }
3131
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }

0 commit comments

Comments
 (0)