【发布时间】:2018-05-13 10:20:11
【问题描述】:
我正在 IntelliJ 中创建 gradle spring boot 项目,但我无法解决一些依赖项。
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
build.gradle 看起来像
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "joda-time:joda-time:2.2"
compile "log4j:log4j:1.2.16"
compile "org.mongodb:mongo-java-driver:1.3"
compile "org.springframework:spring-core:5.0.2.RELEASE"
compile "org.springframework:spring-context:3.0.2.RELEASE"
compile "org.springframework:spring-web:3.0.4.RELEASE"
compile "org.springframework:spring-webmvc:2.5.2"
compile "org.jetbrains:annotations:13.0"
compile "com.google.guava:guava:23.4-jre"
compile "org.springframework.boot:spring-boot-autoconfigure:1.5.6.RELEASE"
}
我尝试了各种版本的 spring-boot 依赖项,但找不到缺少的内容。任何帮助表示赞赏。
【问题讨论】:
-
你是不是错过了 spring-boot 插件?
-
停止混合 spring 版本...您正在混合 5.0.2、3.0.2 和 2.5.2 永远不要混合框架的版本。
-
在 Spring Boot 中,您甚至不需要为常见依赖项指定版本。 gradle 插件将为您处理版本管理,它将为您提供正确(且兼容)的版本。
标签: spring spring-boot intellij-idea gradle intellij-14