spring boot jsps没有渲染

时间:2014-03-31 11:13:27

标签: gradle spring-boot

我的构建gradle看起来像这样

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-milestone" }
        mavenLocal()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC5")
    }
}

configurations {
    jasper
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'

war {
    baseName = 'foo-serving-web-content'
    version =  '0.1.1'
}

repositories {
    mavenCentral()
    maven { url "http://repo.spring.io/libs-milestone" }
}

dependencies {
    compile("org.springframework:spring-webmvc:4.0.0.M2")
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("javax.servlet:javax.servlet-api:3.1.0")
    compile("javax.servlet:jstl:1.1.2")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

现在问题是我的jsps没有被渲染,只是简单的XML。 我发现这篇文章有人有问题,但他们正在使用maven。

JSP file not rendering in Spring Boot web application

我的build.gradle有问题吗?

1 个答案:

答案 0 :(得分:5)

有些事情出现了错误:

  1. 您不需要将“spring-webmvc”作为显式依赖项,并且您使用的是非常旧的版本。只要把它拿出来你就会得到4.0.3。

  2. 你没有加入Jasper(尽管看起来你的意思是“jasper”配置) - example here(它是maven,但你会得到图片)。

  3. 您尚未将tomcat依赖项标记为“providedRuntime”(see here for example,因此我假设您不需要可部署的WAR。

  4. 你可能应该解决所有这些问题,但如果你做了一个子集,你可能会得到一些工作。