我刚接触弹簧,并尝试在弹簧靴中使用力度。
这是我的build.gradle
repositories {
mavenCentral()
}
plugins {
id 'org.springframework.boot' version '2.0.4.RELEASE'
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-velocity')
runtime('org.springframework.boot:spring-boot-devtools')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)
当我通过同步时./gradlew bootRun
,它返回如下错误。
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-velocity:.
Run Code Online (Sandbox Code Playgroud)
您很可能忘记了包含Spring的依赖管理插件。
apply plugin: 'io.spring.dependency-management'
还要确保已指定要使用的Spring Boot版本:
plugins {
id 'org.springframework.boot' version '2.0.4.RELEASE'
}
参见https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/gradle-plugin/reference/html/了解更多信息
Spring Boot 2.0 依赖于 Spring Framework 5.0。这放弃了对 Velocity 的支持。因此在 Spring Boot 2 中不再支持 Velocity。
如果您真的需要 Velocity,则必须坚持使用 Spring Boot 1.5。如果你可以使用 Freemarker 或 Mustache 之类的东西,你可能会更好地使用它。
归档时间: |
|
查看次数: |
6180 次 |
最近记录: |