首页 文章

Spring Boot Gradle插件bootRun任务无法识别Yeoman何时生成静态文件并使用grunt更新

提问于
浏览
1

我有一个用Yeoman生成的Backbone应用程序 . 使用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);
    }

2 回答

  • 0

    我创建了一个Yeoman插件,完全相同,但是使用Maven .

    我们有一个使用Maven构建的Spring Boot后端,它与使用Grunt构建的AngularJS前端配合使用 .

    你可以在这里找到这个Yeoman发电机:https://github.com/jhipster/generator-jhipster

  • 1

    我让你的应用程序运行,并验证从 src/main/resources 提供的资源可以重新加载,但直到今天才使用Maven(这里是issue about that) . 如果你想进一步讨论,我的github问题很好 .

相关问题