- wrapper 9.5.1 → 9.5.0:Boot 4.1 插件要求 8.14+ 或 9.x,而 KGP 2.4.10 的完全 支持上限是 9.5.0,9.5.1 已在 KGP 支持区间之外。 - settings.gradle 加 pluginManagement:插件走 Gradle Plugin Portal,不经过 Maven Central,只配根 build.gradle 的 repositories 覆盖不到插件那一半。 - 两处均保留官方源兜底,镜像在前、官方源在后,镜像缺失时自动回落。 - 不加 google():那是 Android 构件的仓,后端项目用不到。 - 实测构件可下载,全项目 Gradle 弃用警告归零(url 用 `=` 赋值,非空格赋值)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
60 lines
2.2 KiB
Groovy
60 lines
2.2 KiB
Groovy
plugins {
|
||
id 'org.jetbrains.kotlin.jvm' version '2.4.10' apply false
|
||
id 'org.jetbrains.kotlin.plugin.spring' version '2.4.10' apply false
|
||
id 'org.jetbrains.kotlin.kapt' version '2.4.10' apply false
|
||
id 'org.springframework.boot' version '4.1.0' apply false
|
||
}
|
||
|
||
subprojects {
|
||
apply plugin: 'java-library'
|
||
apply plugin: 'org.jetbrains.kotlin.jvm'
|
||
apply plugin: 'org.jetbrains.kotlin.plugin.spring'
|
||
|
||
group = 'com.continental.retailapp'
|
||
version = '0.1.0-SNAPSHOT'
|
||
|
||
repositories {
|
||
maven { url = 'https://maven.aliyun.com/repository/public' }
|
||
maven { url = 'https://maven.aliyun.com/repository/google' }
|
||
google()
|
||
mavenCentral()
|
||
}
|
||
|
||
java {
|
||
toolchain {
|
||
languageVersion = JavaLanguageVersion.of(21)
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
// 版本对齐一律走 Gradle 原生 platform() BOM,不引 io.spring.dependency-management 插件
|
||
implementation platform('org.springframework.boot:spring-boot-dependencies:4.1.0')
|
||
implementation platform('org.springframework.cloud:spring-cloud-dependencies:2025.1.2')
|
||
testImplementation platform('org.springframework.boot:spring-boot-dependencies:4.1.0')
|
||
testImplementation platform('org.springframework.cloud:spring-cloud-dependencies:2025.1.2')
|
||
|
||
implementation 'org.jetbrains.kotlin:kotlin-reflect'
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||
testImplementation 'io.mockk:mockk:1.14.2'
|
||
// Gradle 9 不再自带 JUnit Platform launcher,starter-test 也不带,必须显式声明,
|
||
// 否则 test 任务直接报 "Could not start Gradle Test Executor"。版本由 junit-bom 管。
|
||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||
}
|
||
|
||
kotlin {
|
||
compilerOptions {
|
||
freeCompilerArgs.add('-Xjsr305=strict')
|
||
}
|
||
}
|
||
|
||
tasks.withType(Test).configureEach {
|
||
useJUnitPlatform {
|
||
// 本地快速验证:./gradlew build -PexcludeIntegration
|
||
// CI 按 09-build-deploy.md 跑完整 ./gradlew test(Runner 需能起 Docker,见 10-testing.md)
|
||
if (project.hasProperty('excludeIntegration')) {
|
||
excludeTags 'integration'
|
||
}
|
||
}
|
||
}
|
||
}
|