I am trying to follow this example to do spring boot
and spring boot dev tools
integration to do automatic restart. The classes in the build folder are getting updated when i run build --continuous
task but the application still talks to the old classes. In the example the bootRun
task is as below. My project has its custom task for running the application. Right now with build -continuous
when I make a change the application it is rebuilding the classes but the running application is not showing the changes. How to change my custom h2Run
task so that it loads the changed classes? Thank you.
The boot run task in the example
bootRun {
classpath = sourceSets.main.runtimeClasspath + configurations.dev
}
My custom task for bootRun
class Run extends JavaExec {
Run() {
group "application"
dependsOn project.tasks.classes, project.tasks.pathingJar
classpath = project.files("$project.buildDir/classes/main", "$project.buildDir/resources/main", project.tasks.pathingJar.archivePath)
main = "com.mycompany.Application"
}
}
task h2Run(type: Run) {
classpath = sourceSets.main.runtimeClasspath + configurations.dev // this is not working
description "Start $appName using H2 database"
args "--spring.profiles.active=dev"
mustRunAfter 'cleanH2'
dependsOn copyContentTypeLibraries
}