From 7a5a672b8a2a51b73bfa4a7f09e28caef0f8a001 Mon Sep 17 00:00:00 2001 From: tschuehly Date: Fri, 3 Nov 2023 15:14:12 +0100 Subject: [PATCH] trigger livereload after updating classes --- .../processor/ViewComponentChangeListener.kt | 14 +++++---- examples/jte-example/settings.gradle.kts | 30 +++++++++---------- .../src/main/resources/application.properties | 4 ++- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/processor/ViewComponentChangeListener.kt b/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/processor/ViewComponentChangeListener.kt index bc56326..e62ef65 100644 --- a/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/processor/ViewComponentChangeListener.kt +++ b/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/processor/ViewComponentChangeListener.kt @@ -10,6 +10,7 @@ import org.springframework.boot.devtools.filewatch.ChangedFiles import org.springframework.boot.devtools.filewatch.FileChangeListener import org.springframework.context.ApplicationContext import org.springframework.context.ApplicationEventPublisher +import org.springframework.context.event.ContextRefreshedEvent class ViewComponentChangeListener( @@ -39,11 +40,14 @@ class ViewComponentChangeListener( viewComponentName = javaClass.simpleName.lowercase() ) parser.parseFile(true) - if(srcFile.extension == "kte" || srcFile.extension == "jte"){ - applicationEventPublisher.publishEvent(ClassPathChangedEvent(this, changeSet, true)) - }else{ - applicationEventPublisher.publishEvent(ClassPathChangedEvent(this, changeSet, false)) - } +// applicationEventPublisher.publishEvent(ContextRefreshedEvent(applicationContext)) +// applicationEventPublisher.publishEvent(ClassPathChangedEvent(this, changeSet, false)) +// if(srcFile.extension == "kte" || srcFile.extension == "jte"){ +// // TODO: if restart is set to false then update resources in intelliJ triggers livereload +// applicationEventPublisher.publishEvent(ClassPathChangedEvent(this, changeSet, false)) +// }else{ +// applicationEventPublisher.publishEvent(ClassPathChangedEvent(this, changeSet, false)) +// } } } diff --git a/examples/jte-example/settings.gradle.kts b/examples/jte-example/settings.gradle.kts index c046dbf..214729c 100644 --- a/examples/jte-example/settings.gradle.kts +++ b/examples/jte-example/settings.gradle.kts @@ -1,16 +1,16 @@ rootProject.name = "jte-example" -//includeBuild("..\\..\\jte\\jte"){ -// dependencySubstitution { -// substitute(module("de.tschuehly:spring-view-component-jte")).using(project(":")) -// } -//} -//includeBuild("..\\..\\jte\\jte-compiler"){ -// dependencySubstitution { -// substitute(module("de.tschuehly:spring-view-component-jte-compiler")).using(project(":")) -// } -//} -//includeBuild("..\\..\\core"){ -// dependencySubstitution { -// substitute(module("de.tschuehly:spring-view-component-core")).using(project(":")) -// } -//} \ No newline at end of file +includeBuild("..\\..\\jte\\jte"){ + dependencySubstitution { + substitute(module("de.tschuehly:spring-view-component-jte")).using(project(":")) + } +} +includeBuild("..\\..\\jte\\jte-compiler"){ + dependencySubstitution { + substitute(module("de.tschuehly:spring-view-component-jte-compiler")).using(project(":")) + } +} +includeBuild("..\\..\\core"){ + dependencySubstitution { + substitute(module("de.tschuehly:spring-view-component-core")).using(project(":")) + } +} \ No newline at end of file diff --git a/examples/jte-example/src/main/resources/application.properties b/examples/jte-example/src/main/resources/application.properties index 9991428..d95601c 100644 --- a/examples/jte-example/src/main/resources/application.properties +++ b/examples/jte-example/src/main/resources/application.properties @@ -1,2 +1,4 @@ spring.view-component.local-development=true -server.port=8082 \ No newline at end of file +server.port=8082 + +logging.level.org.springframework: DEBUG \ No newline at end of file