Mag*_*sik 39 intellij-idea gradle spring-boot spring-boot-gradle-plugin
我正在尝试使用 Spring Boot Gradle 插件的 3.0.0 版本。这是我的 build.gradle.kts 文件:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.0.0"
id("io.spring.dependency-management") version "1.1.0"
kotlin("jvm") version "1.7.20"
kotlin("plugin.spring") version "1.7.20"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
}
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
runtimeOnly("org.postgresql:postgresql")
runtimeOnly("org.postgresql:r2dbc-postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
jdbc("org.postgresql:postgresql:42.5.0")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
Run Code Online (Sandbox Code Playgroud)
我在下面粘贴了错误。我知道这不是网络问题,因为当我将版本更改为 2.7.6 时,错误消失了。
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.0
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.0 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
Run Code Online (Sandbox Code Playgroud)
Mag*_*sik 124
在 IntelliJ => Preferences => Build、execution、deployment => Gradle 下,我必须将 Gradle JVM 设置为:Project SDK (17)。
我不确定为什么 2.7.6 和 2.7.1 spring boot 插件版本可以在 Gradle JVM 设置为 Java 11\xe2\x80\xa6 的情况下工作,似乎 spring boot Gradle 插件 3.0.0 更严格。
\n 归档时间: |
|
查看次数: |
32566 次 |
最近记录: |