I have been working on a Spring Boot website for a few months, using VS Code as my IDE.
I have Live Reload setup, so that it was automatically rebuilding and rerunning the website locally whenever I changed/saved any of the Java server files AND the static files (including JS files, and the template HTML files).
However, today VS Code crashed suddenly. It was no big deal, nothing was lost. Although now it seems like Live Reload can not identify when I have made a change to any of the files under my ‘resources’ folder.
When I make a change to a java file (under src/main/java) it triggers the Live Reload.
However when I make a change to a JS or HTML file (under src/main/resources) it does NOT trigger the live reload (however it did before the crash).
From what I can tell src\main\resources is still included on the classpath, but it’s refusing to acknowledge it’s change to trigger the Live Reload.
I have reset my code to a stage it was in when it was working fine to ensure my code itself wasn’t somehow responsible.
All I want is for the Live Reload to go back to how it was, when it would trigger from a change to files within src/main/resources.
Thanks in advance.
Edit 1:
I realised I should clarify how I run the application from VS Code.
I used to right-click on my main Application class and go “Run Java”, or “Debug Java”. This worked perfectly with live reload.
Now when I try and do that, as I explained the java files still trigger the Live Reload, but the static files do not. And if I make a change to the static files, even after re-running I do not see the changes. (Like it only builds the project once and doesn’t bother rebuilding)
Instead now I have to use ‘mvn spring-boot:run’ in the cmd line.
Running this will correctly trigger Live Reload when a java file is changed, but still won’t trigger the Live Reload for a static file
But atleast when I rerun the command it rebuilds the project and I can see the new static file change.
Edit 2: I also realised it has broken for my other projects where I was also able to do this recently, also in VS Code. Therefore it seems like a VS Code issue.
Solved it, after narrowing down it was specifically a VS code issue. It turns out it was the latest VS Code patch that seems to have broken it for me.
I was on version 1.84.1
I reverted back to 1.83.1, and my problem disappeared.
Hope this might help anyone else running into this.