Reputation: 21486
Tomcat in Eclipse is ignoring source HTML changes and not publishing them, even though it worked fine before.
I have Windows 10 Pro 64-bit, with Tomcat 8.5.6 installed in C:\bin\tomcat
. I am running Eclipse Java EE 4.7.0, installed in D:\bin\eclipse
(a separate volume). Tomcat has been added as an 8.5 server. My workspace is in D:\workspace
. I have a Maven web application in D:\workspace\project
, with HTML file index.html
in src/main/webapp
. My project has the "Dynamic Web Module 3.1" facet enabled. I have added a "Tomcat v8.5 Server at localhost" in the "Servers" tab, and I have added my project to the server. I have turned off caching in my browser.
With the above configuration, on the machine laptop1
I would start the server and I could access my index.html
in a browser via localhost
. If I edited index.html
, as soon as I saved it Tomcat would quickly show that the files needed publishing, and then would auto-publish the changed file. I could refresh the browser and see the changed HTML file immediately. I worked in this development environment for six to nine months.
I configured a virtually identical machine laptop2
by installing the same version of Tomcat in C:\bin\tomcat
as before. I connected the volume D:
to laptop2
. I built the project and started Tomcat. I was able to open the browser and see index.html
via localhost
.
But now if I edit index.html
, even inside Eclipse, the changes do not show up in the browser.
src/main/webapp/index.html
has new content and has its timestamp updated.target/m2e-wtp/web-resources
do not change after editing index.html
, even if I restart the server.laptop1
and laptop2
.I am at a loss to think of what else I could check. I do not know if moving from one system to the other had anything to do with Tomcat stopping recognizing and publishing file changes.
Upvotes: 0
Views: 1269
Reputation: 21486
Somehow "Build Automatically" had been disabled.
Yes, the source of all these problems is that somehow in Eclipse the option Project > Build Automatically had been turned off. I don't know how. I don't know when. But once re-enabled, everything started working again exactly as it had been before.
I probably would have found this sooner or (much) later, but I stumbled across an answer to another question in which @mico mentioned this in passing. I am grateful.
Upvotes: 1