Skip to content

Springboot CLI - Hot Reload Not Triggering #17820

@TheGitHubGuy1

Description

@TheGitHubGuy1

Referenced Docs:
https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/gradle-plugin/reference/html/
https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/reference/html/using-boot-devtools.html
https://guides.gradle.org/building-spring-boot-2-projects-with-gradle/

SpringBoot Version: v2.1.7.RELEASE
Gradle Version: 5.5.1
OS: Ubuntu 18.04.3 LTS
Java Version: 11.0.4

I built the project with command: gradle init --type java-application
I ran the project with ./gradlew bootRun

Project runs fine, it's just the code from: https://guides.gradle.org/building-spring-boot-2-projects-with-gradle/

Upon altering the code in, for example, HelloGradleController.java to return "Hello Gradle!!" there is no detection of file change or hot-reload.

Upon shutting down (Ctrl+C) and executing ./gradlew bootRun the project starts up and the changes are detected when I visit localhost:8080 once again.

bootRun prompt:

> Task :bootRun

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.7.RELEASE)

2019-08-09 11:04:01.080  INFO 4893 --- [  restartedMain] example.App                              : Starting App on ben-VirtualBox with PID 4893 (/home/ben/SpringBootProjects/gradle-spring-boot-project/build/classes/java/main started by ben in /home/ben/SpringBootProjects/gradle-spring-boot-project)
2019-08-09 11:04:01.083  INFO 4893 --- [  restartedMain] example.App                              : No active profile set, falling back to default profiles: default
2019-08-09 11:04:01.177  INFO 4893 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-08-09 11:04:01.178  INFO 4893 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-08-09 11:04:02.806  INFO 4893 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-08-09 11:04:02.856  INFO 4893 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-08-09 11:04:02.856  INFO 4893 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.22]
2019-08-09 11:04:02.996  INFO 4893 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-08-09 11:04:02.996  INFO 4893 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1818 ms
2019-08-09 11:04:03.272  INFO 4893 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-09 11:04:03.478  INFO 4893 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2019-08-09 11:04:03.550  INFO 4893 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-08-09 11:04:03.560  INFO 4893 --- [  restartedMain] example.App                              : Started App in 2.994 seconds (JVM running for 3.488)
<=========----> 75% EXECUTING [9s]
> :bootRun

My build.gradle

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java project to get you started.
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * User Manual available at https://docs.gradle.org/5.5.1/userguide/tutorial_java_projects.html
 */

plugins {
    // Apply the java plugin to add support for Java
    id 'java'

    // Apply the application plugin to add support for building a CLI application
    id 'application'
    
    //https://guides.gradle.org/building-spring-boot-2-projects-with-gradle/
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}


bootRun {
    sourceResources sourceSets.main
}


repositories {
    // Use jcenter for resolving dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

//https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/reference/html/using-boot-devtools.html
configurations {
   developmentOnly
   runtimeClasspath {
       extendsFrom developmentOnly
   }
}

dependencies {
    //compile('org.springframework.boot:spring-boot-devtools')
    developmentOnly('org.springframework.boot:spring-boot-devtools')

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:27.1-jre'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'

    //https://guides.gradle.org/building-spring-boot-2-projects-with-gradle/
    implementation 'org.springframework.boot:spring-boot-dependencies:2.1.7.RELEASE'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    components {
        withModule('org.springframework:spring-beans') {
            allVariants {
                withDependencyConstraints {
                    // Need to patch constraints because snakeyaml is an optional dependency
                    it.findAll { it.name == 'snakeyaml' }.each { it.version { strictly '1.19' } }
                }
            }
        }
    }
}

application {
    // Define the main class for the application
    mainClassName = 'example.App'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions