Enable IntelliJ hotswap of html and javascript files
Asked Answered
O

5

21

I'm fairly new to IntelliJ and I'm using it to develop an AngularJS / Java web application. When I make changes to HTML or JavaScript code, I always have to restart the app server (I'm using Jetty). Is there a config or plugin that provides hotswap for HTML/JS/CSS files?

I'm using IntelliJ 12 Ultimate edition.

Okechuku answered 28/8, 2013 at 15:41 Comment(2)
See jetbrains.com/idea/webhelp/… .Peeve
@CrazyCoder: your link is brokenLoya
H
12

You need the option "Update resources". You should be able find this option in your server Run/Debug configuration.

Heroine answered 28/8, 2013 at 16:0 Comment(4)
The problem is that when I modify an HTML/JS/CSS file, nothing is getting triggered in IntelliJ to do anything. I think IntelliJ watches for changes to Java code but not to resources.Okechuku
I was able to get it working by setting Run/Debug configuration --> "On frame deactivation" to "Update classes and resources". At first I had tried setting the "On 'Update' action" but that event was not getting fired after modifying a resource.Okechuku
"On 'Update' action" means what should happen when you hit Update button. This button is in your tab with running applications.Heroine
Ah, okay. I also discovered that the "Update classes and resources" options are only available when the deployment option is an "exploded" war.Okechuku
P
31

I had the same problem but I already fixed it. You can follow this steps:

  1. Go to Help->Find Action
  2. Type "Registry".
  3. Find and mark : “compiler.automake.allow.when.app.running”.
  4. Close the Dialog.
  5. Go to "Settings->Build, Execution, Deployment->Compiler".
  6. Mark "Build project automatically".
  7. Apply changes.
  8. Go to Spring Boot Configuration and if everything goes well it will display a warning about "background compilation", Run your Spring Boot Application and you should be able to see your statisc's files changes when refresh your browser.

Hope it helps.

Pollitt answered 5/4, 2017 at 14:24 Comment(6)
(y) Great that it helped you! @MonirPollitt
@RafaelReyes Thanks a lot, it works. But why it's not default option and why there is red warning like error on spring boot configuration? Is there any drawbacks of this solution.Emphasis
As a note, "Settings" on a Mac is PreferencesAmoy
Helped for me. Also check this: garywaddell.com/2015/11/20/… (As JeanValjean stated, yes on a mac it is different "Settings" is "Preferences")Tetrasyllable
Saved me. ThanksInweave
@RafaelReyes awesome, super helpful.Fitting
H
12

You need the option "Update resources". You should be able find this option in your server Run/Debug configuration.

Heroine answered 28/8, 2013 at 16:0 Comment(4)
The problem is that when I modify an HTML/JS/CSS file, nothing is getting triggered in IntelliJ to do anything. I think IntelliJ watches for changes to Java code but not to resources.Okechuku
I was able to get it working by setting Run/Debug configuration --> "On frame deactivation" to "Update classes and resources". At first I had tried setting the "On 'Update' action" but that event was not getting fired after modifying a resource.Okechuku
"On 'Update' action" means what should happen when you hit Update button. This button is in your tab with running applications.Heroine
Ah, okay. I also discovered that the "Update classes and resources" options are only available when the deployment option is an "exploded" war.Okechuku
D
1

As i found this thread interesting, i also found a lot of explanations here: https://www.jetbrains.com/idea/help/updating-applications-on-application-servers.html

Dishonor answered 28/11, 2014 at 12:52 Comment(0)
F
1

Also, a keyboard shortcut(e.g. Ctrl+F5 or Cmd+F5) to "Run -> Reload changed classes" might come handy. It helps me to save changes multiple times and then restart the server when I'm done (unless using JRebel :)

Foxglove answered 28/8, 2017 at 23:3 Comment(0)
R
1

One more thing, which might not be obvious - to activate the automatic build you have to activate the IntelliJ window. It is still very convenient, although you have to switch windows when operation only in the browser.

Rosaleerosaleen answered 6/3, 2018 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.