1

I'm trying to develop a web application using Intellij Ultimate ver 2020.1.4 and Tomcat ver 8.5.23.

Whenever I try to run the program through Intellij, if I make some changes (particularly to the html or javascript files) and try to update, then the changes don't appear in the browser. Depending on if I'm deploying using a WAR Archive or a WAR Exploded Archive, it sometimes uses even older versions of my files that I've long since written over!

I've tried editing the configuration to rebuild the artifact before deployment, to redeploy on 'Update' or frame deactivation, to run in debug mode, but nothing seems to work consistently.

The basic structure of my application looks like this:

LogicEngine (module) 
-src (dir)
--User (dir)
---User (dir)
----User.java
----UserManager.java

WebApp (module)
-src (dir)
--sdm (dir)
---servlets (dir)
----ChatServlet.java
--web(dir)
---sharedresources (dir)
---- jquery
---pages (dir)
---- homepage (dir)
-----homepage.html
-----homepage.css
-----homepage.js
--WEB-INF
---web.xml
-index.html

I run the application from intellij and make changes to homepage.js. When I click 'Update'--> Redeploy, and then hit refresh on the browser, the changes don't appear (I know because I check the js file using developer tools). Restarting the server doesn't work either. The only thing that has seemed to work (and even this not reliably) is if I remove the artifacts from the project and the webapp from Tomcat, create them all over again, and then click 'run'.

Adam G
  • 39
  • 1
  • 2
  • What IDE/Tomcat versions do you use? What are the frameworks used by your app? Please share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) with the exact steps to reproduce the problem. – CrazyCoder Oct 08 '20 at 18:21
  • @CrazyCoder I added some details that hopefully clarify things. The actual program is pretty long and there are a lot more files, but I don't think there's any specific code that would be relevant. The browser finds homepage.js, so if I make any changes to that file (say just by adding an extra line) and update, I assume those changes should be visible in the browser. – Adam G Oct 08 '20 at 19:28
  • 2
    Does the `.js` file change on disk in the artifact output directory after the Update action? If it does, then it could be some browser cache. – CrazyCoder Oct 08 '20 at 19:29
  • @CrazyCoder wow, yes the js file on disk is updated. Cleaning the browser cache and history seemed to help. But does this mean I have to clean the cache every time I make an update? (in any case, thanks!) – Adam G Oct 08 '20 at 19:37
  • Does [this answer](https://stackoverflow.com/a/8392547/104891) help? – CrazyCoder Oct 08 '20 at 20:36

0 Answers0