Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

spring boot - IntelliJ 15, SpringBoot devtools livereload not working

Having issues with the new LiveReload feature with Spring Boot devtools 1.3. It doesn't reload on class changes. I've seen it demo'd with IntelliJ @ Devoxx 2015. Is there some IDE setting I need to have enabled? I'm running via the IDE and not through Gradle. I tried enabling "Make project automatically" which doesn't seem to help.

It seems to load correctly and is looking in the correct path

2015-11-23 05:55:30.592 DEBUG 4700 --- [  restartedMain] o.s.boot.devtools.restart.Restarter      : Starting application com.myapp.Application with URLs [file:/E:/Projects/myapp/build/classes/main/, file:/E:/Projects/myapp/build/resources/main/]

My files

build.gradle

buildscript {
    ext {
        springBootVersion = '1.3.0.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    }
}

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'spring-boot' 
apply plugin: 'war'


war {
    baseName = 'myapp'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-devtools')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.projectlombok:lombok')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('net.sourceforge.jtds:jtds:1.3.1');
    testCompile('org.springframework.boot:spring-boot-starter-test') 
}

dependencyManagement {
    imports { 
        mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.M3" 
    }
}


eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.7'
}

HelloWorldController

@Controller
public class HelloWorldController {

    @RequestMapping("/")
    @ResponseBody
    String home(){

        return "Hello World test";
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To solve this You can do like:

  1. Add LiveReload extension in your browser.
  2. Add devtools dependencies to your pom.xml(if it's maven (spring-boot-devtools)).
  3. In your intellij IDEA go to: file->settings->build,execution,deployment. Go to ->compiler->build project automatically.
  4. In your intellij IDEA: SHIFT+Ctrl+A ->registry-> compiler.automake.allow.when.app.running

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...