Using jettyRunWar or jettyRun in Gradle with the Spring app to load results in just a list of directories in the browser

I am using Gradle and Spring Boot for the first time. I decided to create a project that actually creates a WAR archive, and I am using the Gradle Jetty plugin. If I run jettyRun or jettyRunWar tasks, in my browser all I see is a list of directories, not my actual application.

For example, the jettyRunWar task results in a list of directories like this:

META-INF/
WEB-INF/
dist/

The dist / directory contains my static files.

Perhaps I am missing something fundamental, since I am using Gradle and Spring Boot for the first time.

I am trying to test my application by making changes to my static files without restarting the application. Here is my build.gradle file.

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

apply plugin: "java"
apply plugin: "idea"
apply plugin: "spring-boot"
apply plugin: "war"

war {
    baseName = "mis-support-client"
    version =  "1.0.0-SNAPSHOT"
    includes = ["dist/**"]
}

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

dependencies {
    testCompile "junit:junit:4.11" 

    compile ("org.springframework.boot:spring-boot-starter-web:0.5.0.M7") {
        exclude module: "spring-boot-starter-tomcat"
    }
    compile "org.springframework.boot:spring-boot-starter-jetty:0.5.0.M7"
    compile "org.springframework.boot:spring-boot-starter-security:0.5.0.M7"
    compile "org.springframework.boot:spring-boot-starter-websocket:0.5.0.M7" 
    compile "javax.inject:javax.inject:1"
    compile "org.codehaus.jackson:jackson-mapper-asl:1.9.12"
    compile "org.apache.httpcomponents:httpclient:4.3.1"
    compile "commons-io:commons-io:2.4"
}

task wrapper (type: Wrapper) {
    gradleVersion = "1.8"
}
+4
1

./gradlew bootRun ? Spring :)

gradle:

apply plugin: 'spring-boot'

Tomcat Jetty ( WAR)

Task

Execution tasks
---------------
bootRun - Run the executable JAR/WAR
+4

All Articles