Ari*_*ric 5 java spring gradle spring-boot
尝试使用 gradle bootRun 运行我的程序时,错误显示
无法应用名为“runtime”的插件“org.springframework.boot”配置未找到
以下是我的 build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
}
}
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
jar {
baseName = 'blockchain-demo'
version = '0.0.1'
}
war {
baseName = 'blockchain-demo'
version = '0.0.1'
}
application {
mainClass = 'web.Application'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-devtools")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
Run Code Online (Sandbox Code Playgroud)
我假设您使用的是 Gradle 7。在 Gradle 7中,配置compile、testCompile和已被删除,取而代之的是、和。这就是 Gradle 问题的原因runtimetestRuntimeimplementationtestImplementationruntimeOnlytestRuntimeOnly
无法应用插件“org.springframework.boot”未找到名称为“runtime”的配置
要解决此问题,您应该使用您正在使用的 Spring Boot Gradle 插件版本支持的 Gradle 版本(1.5.3,根据提供的代码片段)。系统要求将 Gradle 版本 2 和 3 列为 Spring Boot 1.5.3 的要求。此后的一切均不受支持。