我是spring的新手,正在尝试在spring boot中使用velocity。
这是我的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')
}当我通过./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:.发布于 2018-08-07 17:02:49
Spring Boot 2.0依赖于Spring Framework 5.0。哪个dropped support for Velocity。因此,在Spring Boot2中,不再支持Velocity。
如果你真的需要Velocity,你必须坚持使用Spring Boot 1.5。如果您可以使用Freemarker或Mustache之类的工具,您可能会更好地使用它们。
发布于 2018-08-07 16:01:39
很可能你忘了包括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/
https://stackoverflow.com/questions/51721657
复制相似问题