Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA doesn't redeploy changes

I have a Spring Web application and when I debug with IDEA's debbuger in Tomcat and redeploy the project after some changes, the changes are not deployed and debugger "sees" the old code (stepping through wrong or empty lines). Only thing that helps is to run maven clean install and then start the Tomcat again.

I tried clearing IDEA caches but it didn't help.

Hotswap also doesn't work, although I have correct options selected in settings, but I can live with that.

Note that I use redeploy not hotswap, so the whole application is started again, it should reload all classes but it doesn't. Only after maven build it works.

Note 2: I think it work ok one month ago, but no changes I can think of could do this (project- or IDEA-wise)

EDIT: So hotswap is now working OK (magically, I didn't do anything). But when I make larger modifications (eg. method signature change, etc), they are not picked up during REDEPLOY to the server. So I neeed to run maven clean install and start the server again to see the changes and for hotswap to work properly after method body modifications on this new code. Any idea why?

like image 744
redhead Avatar asked Jan 09 '15 10:01

redhead


2 Answers

You need to check your run configurations of tomcat, in "Before launch" there should be Make and Build artifact steps, also be sure that all you changed classes are really compiling during redeploy - this is the place I would start from.

Also I don't get why you use redeploy instead of hot-swap? Redeploy is usually same time-consuming as restart server, but hot-swap is nearly instant. Though it allows only to change method bodies and constants, usually it's much prefferable then redeploy in development. Personally I'm using JRebel which is free for non-commercial projects now and restart server very rare.

EDIT: I don't know why your classes are old even after redeploy, but the reason is 99% that they do not compile after changes into exploded folder. Doing maven clean install after each code change is too much (IDE compilation should be enough).

What I can suggest you is not to redeploy but to restart server after big changes. So that IDE perform Make, Build artifact and Deploy artifact tasks.

like image 149
davidluckystar Avatar answered Oct 16 '22 20:10

davidluckystar


In addition to david.lucky hints, make sure that on your Tomcat configuration in the deployment section you're using an exploded artifact

like image 31
Master Slave Avatar answered Oct 16 '22 19:10

Master Slave