1

Yeoman で生成されたバックボーン アプリがあります。Spring Boot Gradle プラグインを bootRun タスクと共に使用してアプリを実行し、JS ソースに変更を加えて Grunt を実行し、ソースを dist ディレクトリに再コンパイル/縮小すると、それらの変更は現在実行中の bootRun タスクに反映されません。 .

build.gradle

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

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

「dist」ディレクトリをマッピングするための顧客リソース ハンドラを次に示します。

@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/bower_components/**", "/scripts/**", "/styles/**", "/fonts/**", "/font/**")
                .addResourceLocations("/dist/bower_components/", "/dist/scripts/", "/dist/styles/", "/dist/bower_components/bootstrap/fonts/", "/dist/bower_components/font-awesome/font/")
                .setCachePeriod(315569126);
    }
4

2 に答える 2