我正在使用 Spring Boot。我创建了 Spring Boot gradle 应用程序。我收到以下错误。
引起:java.lang.ClassNotFoundException:org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter
构建.gradle
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
jar {
baseName = 'demo'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile group: 'org.springframework', name: 'spring-web', version: '4.0.0.RELEASE'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.12'
compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.12'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.2.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.2.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.2.2'
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
我是否缺少 build.gradle 中的任何依赖项?
如何解决这个问题?