当静态文件由约曼生成和更新的呼噜声春引导摇篮插件bootRun任务不承认 [英] Spring Boot Gradle plugin bootRun task not recognizing when static files are generated by Yeoman and updated with grunt

查看:148
本文介绍了当静态文件由约曼生成和更新的呼噜声春引导摇篮插件bootRun任务不承认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个约曼生成的主干应用程序。使用具有bootRun任务沿着弹簧引导摇篮插件来运行应用程序,当我修改我的JS源代码并运行咕噜重新编译/运行如下我的源到dist目录,这些变化不会反映在当前正在运行的任务bootRun

的build.gradle

  buildscript {
    库{
        行家{URLhttp://repo.spring.io/snapshot}
        行家{URLhttp://repo.spring.io/milestone}
        mavenLocal()
    }
    依赖{
        类路径org.springframework.boot:弹簧引导gradle这个-插件:0.5.0.M7
    }
}应用插件:Java的
应用插件:理念
应用插件:春天启动
应用插件:战争战争{
    baseName的=MIS支持客户
    版本=1.0.0快照
    包括= [DIST / **]
}库{
    mavenCentral()
    行家{URLhttp://repo.spring.io/libs-snapshot}
}依赖{
    testCompile的JUnit:JUnit的:4.11    编译(org.springframework.boot:春天开机起动的Web:0.5.0.M7){
        排除模块:春天开机起动,雄猫
    }
    编译org.springframework.boot:春天开机起动-码头:0.5.0.M7
    编译org.springframework.boot:春天开机起动的安全性:0.5.0.M7
    编译org.springframework.boot:弹簧引导启动器的WebSocket:0.5.0.M7
    编译javax.inject:javax.inject:1
    编译组织codehaus.jackson:杰克逊映射器-ASL:1.9.12
    编译org.apache.httpcomponents:HttpClient的:4.3.1
    编译公地IO:公地IO:2.4
}任务包装(类型:包装){
    gradleVersion =1.8
}

下面是我的客户资源处理程序映射DI​​ST目录。

  @覆盖
    公共无效addResourceHandlers(ResourceHandlerRegistry注册表){
        registry.addResourceHandler(/ bower_components / **,/脚本/ **,/形式/ **,/字体/ **,/字体/ **)
                .addResourceLocations(/距离/ bower_components /,/距离/脚本/,/距离/风格/,/距离/ bower_components /引导/字体/,/距离/ bower_components / FONT-真棒/ FONT /)
                .setCachePeriod(315569126);
    }


解决方案

我收到了你的应用程序运行,并验证资源从的src / main /资源送达可重装,但直到今天只有当我使用Maven(这里是关于问题>)。如果您想进一步讨论GitHub的问题是我的罚款。

I have a Backbone app generated with Yeoman. Using the Spring Boot Gradle plugin along with the bootRun task to run the app, when I make changes to my JS source and run Grunt to recompile/minify my source into the dist directory, those changes aren't reflected in the currently running bootRun task.

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

Here's my customer resource handlers for mapping the "dist" directory.

@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);
    }

解决方案

I got your app to run, and verified that resources served from src/main/resources can be reloaded, but until today only if I use Maven (here's an issue about that). The github issue is fine by me if you want to discuss further.

这篇关于当静态文件由约曼生成和更新的呼噜声春引导摇篮插件bootRun任务不承认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆