We assume, the application server is already configured. The next step is to configure an exploded WAR artifact for the web project. An exploded WAR is a decompressed web application archive, a directory structure that is ready for deployment on an application server. IntelliJ creates it automatically, but nevertheless, you should go to File --> Project Structure --> Artefacts and ensure that the exploded web application ends with the extension .war. If you use Maven, the exploded WAR is created below the target folder. More info on the help page.
You should also check if the Hot Swap is enabled. Go to the File --> Settings --> Debugger --> HotSwap and ensure that all checkboxes are checked and the radio button "Reload classes after compilation" is set to "Always".
As next step, click on the "Edit Configurations..." and go to the configured server. In the "Run/Debug Configurations" dialog, select "Update resources" in the drop-down "On frame deactivation". That means, when you switch to the browser, IntelliJ will copy resource files (JavaScript, CSS) from the source location (src/main/webapp) to the directory where it builds the exploded WAR to deploy.
Hot deployment for changed Java classes is resticted by JVM. E.g. the hot deployment for classes with changed method signature(s) doesn't work. But if you changed a method body, it will work. So, if you don't use JRebel which allows the hot deployment for classes being structurally modified, you can still rely on IntelliJ. All what you need to do for changes in Java classes is to recompile them. For that, you can go to the menu Build --> Compile or simple hit Ctrl + Shift + F9. After that, go to the browser and refresh the page to see changes.
+1 Oleg and nice post, and LOL/smiling that that PrimeFaces IDE forum topic motivated/inspired you to write this blog.
ReplyDeleteHot deployment via IntelliJ...if not using JRebel (restart server and rebuild WAR). NetBeans does this as well. :)
Per my experience, hot deployments can take its toll on servers, so need to set permsize, accordingly. Instead of doing a NetBeans-redeploy-or-restart, I prefer to stop server, deploy/drop-WAR, and start server (via NetBeans).
How does IntelliJ handle the memory/PermGen issue(s) associated with 'hot deployment'(s)?
"How does IntelliJ handle the memory/PermGen issue(s) associated with 'hot deployment'(s)?"
DeleteQuite good. No issues until now. I have -XX:MaxPermSize=700m
Most likely you have a reasonably small application if the redeployment is an acceptable option for you.
DeleteIntelliJ doesn't cope with PermGen in any way. PermGen issues are caused by classloader leaks and can't be prevented on the IDE level.
Yes, sure, PermGen issues are caused by classloader leaks. Almost every app server has the same issue after consecutively redeployments. So, a server restart can rescue.
Delete"I have -XX:MaxPermSize=700m"
ReplyDeleteI thought so. I did the same when i first started developing JSF web app via Glassfish 3.1.x; after setting max perm size to 384 or 512m and 'avoiding' hot deployments, i no longer had the (glassfish) permgen issues. and now, since i am using tomee and still avoiding hot deployments, and setting max perm size = 384m, i have no perm gen issues. :)
"PermGen issues are caused by classloader leaks and can't be prevented on the IDE level. "
well, if you 'avoid' hot deployments via your IDE, then you will definitely 'prevent' PermGen issues via/at-the IDE (level). :)
I have read your blog and got nice information about website designing & development company. Thanks!
ReplyDeleteThis blog is very nice and with the help of Google search engine.
ReplyDeletehttp://www.favour.com.au/
Thank for sharing thoughts for salesforce developer. It's help for making best and innovative web application. This help for giving best ideas.
ReplyDeleteany ideas how to enable the old "update dialog" when the server is already running for IntelliJ Idea 15? With Idea 15, when I click the "debug" button it says "a single instance is already running". And there is only one option which is "stop and rerun" as I posted this issue on stackoverflow: http://stackoverflow.com/questions/33738177/intellij-idea-15-how-to-update-resources-without-restarting-server
ReplyDelete