3

My build gradle looks like this

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'
}

Now the thing is my jsps are not getting rendered, just plain XMLs. I found this post someone had issues but they are using maven.

JSP file not rendering in Spring Boot web application

is there something wrong with my build.gradle ?

Community
  • 1
  • 1
M T
  • 4,099
  • 4
  • 21
  • 27

1 Answers1

5

A few things appear wrong:

  1. you don't need "spring-webmvc" as an explicit dependency, and you are using a very old version. Just leave that out and you'll get 4.0.3.

  2. you haven't included Jasper (despite the fact that it looks like you meant to with the "jasper" configuration) - example here (it's maven but you'll get the picture).

  3. You haven't marked the tomcat dependencies as "providedRuntime" (see here for example, so I assume you don't need a deployable WAR.

You probably ought to address all of those points, but you can probably get something to work if you do a subset.

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • my build.gradle looks like this now http://pastie.org/8982991 Now getting "HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application" – M T Mar 31 '14 at 16:52
  • We don't support servlet 3.1 I think, and your jstl looks old. Try those dependencies without the explicit version and let the Boot plugin resolve them for you. – Dave Syer Mar 31 '14 at 18:14