13

When I click to the debug button after the server is started to update resources with/without classes, the prompt that I shared below is displayed. How can I update resources without restarting server?

ps. I am using Tomcat as a server.

enter image description here

Edit: I have already set the option update resources in the server preferences.

enter image description here

talha06
  • 6,206
  • 21
  • 92
  • 147

4 Answers4

19

Use 'Update application' action, by default Ctrl + F10.

Piohen
  • 1,514
  • 15
  • 23
  • on my macbook with extra keyboard nothing happens: neither CTRL+F10 nor CMD+F10 – Dirk Schumacher Jan 17 '18 at 14:24
  • @DirkSchumacher: check the key shortcut 'Search actions' dialogue. – Piohen Jan 18 '18 at 11:32
  • There is no option to automatically update application on lose of focus in debug like in running or?! – cljk Jun 12 '19 at 13:33
  • @cljk I'm not sure I understand the question... Let's assume I do and you mean losing focus of IDEA's window. But the focus has nothing to do, does it? I mean: you'd like to restart the app or update the classes after you make some changes to the source code, config files, environment, etc. What has it common with the focus? – Piohen Jun 23 '19 at 21:14
  • In normal run mode there is an option to update resources on focus lost of the Idea window. In debug this option is missing. But I got used to the keyboard shortcut (was it ctrl-F10 ?) ... perhaps I'll purchase again a JRebel license – cljk Jun 25 '19 at 08:21
  • @DirkSchumache try CMD+fn+F10 – Yohan E Sep 03 '19 at 07:09
1

You're explicitly trying to restart the server (via clicking on "Debug" while the server is running).

Instead of that you can either use "Update" action from "Run > Update ... application" (which you've already configured to update resources) or re-deploy the artifact.

Btw updating of resources is somehow tricky, if it's not working see my other post on this topic:

https://stackoverflow.com/a/33344839/5060066

Community
  • 1
  • 1
Ivaylo D. Ivanov
  • 3,783
  • 1
  • 12
  • 16
  • no, it was not working in this way previously. For previous versions of Idea, update dialog was displayed when use the hotkey Shift+Alt+D (or when the debug button is clicked) – talha06 Nov 17 '15 at 13:33
1

Steps:

  • In IDEA 2020, edit configuration -> running application update policies ->
    • on 'update' action, change to: Update classes and resources
    • on frame deactivation, change to: Update classes and resources
  • Start in debug mode.

Then each time change code, it will try to redeploy, it may take a second.

Eric
  • 22,183
  • 20
  • 145
  • 196
0

Yes, there is a way can update resources without restart server.

In Server -> Development you can see the project, with the name your_project_name.war.

There are 3 buttons. Push the Deploy button to Redeploy the project.Like the pic follow:

Then refresh the page. You will see the change.

enter image description here

chile
  • 141
  • 1
  • 12
  • 2
    As far as I see, it **redeploys** the web app instead of **hot deploy**; so takes lots of more time than just using **update** or **frame deactivation** events. – talha06 Oct 28 '16 at 07:08
  • 1
    Yes, like I said `Push the Deploy button to Redeploy the project.`. I want hot swap too, but I've not find a way out.So this is the best way to me. – chile Oct 29 '16 at 02:55
  • Doesn't work. Update Application means redeploy project or restart server.(Intellij idea 15, macOS 10.12) – chile Nov 01 '16 at 04:03
  • If I recall correctly, there should be other options such as `"update resources"`, `"update classes with resources"` on the `server configuration` user interface. – talha06 Nov 01 '16 at 07:46
  • If *hot deploy* does not work (like for me when running an exploded EAR file Wildfly after changing properties files) then *redeploy* is way faster (10 secs) than stopping and starting the server (60 secs). It's not optimal, but better than a restart. – Klaro May 07 '20 at 10:59