尝试使用 gradle bootRun 运行我的程序时,错误显示
未能应用插件'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")
}
最佳答案
Spring Boot 2.5.0 支持 Gradle 6.8、6.9 或 7.x
有关 Gradle 7 配置的良好引用,请参见此处:https://docs.spring.io/spring-boot/docs/2.5.0/gradle-plugin/reference/htmlsingle/
这会让你离开地面:
plugins {
id 'org.springframework.boot' version '2.5.0'
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
}
repositories {
mavenCentral()
}
关于java - 找不到名称为 'runtime' 的 org.springframework.boot 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67466790/