<plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <webappDirectory>${project.build.directory}/exploded/${project.build.finalName}.war</webappDirectory> </configuration> </plugin>
Exploded deployment for WildFly on development
TweetPosted on Tuesday Jan 20, 2015 at 07:25PM in Technology
I used archive deployment for long time on development because of this problem: http://stackoverflow.com/questions/24725644/intellij-idea-artifact-xxxxwar-exploded-has-invalid-extension
Archive deployment needs redeploy for reflect updates of every resource even if I updated only static content such as html, css, xhtml and jsp. it’s very annoying but finally I found a solution to use exploded deployment with WildFly and IntelliJ IDEA for WAR application so I leave some notes about it. my environment is WildFly 8.2.0.Final and IntelliJ IDEA 14.0.2.
First, specify webappDirectory which ended with .war to pom.xml in your project so that make WildFly to stop complaining that there’s no suffix to application directory.
According to https://youtrack.jetbrains.com/issue/IDEA-86484, this should be worked for EAR deployments:
<workDirectory>${project.build.directory}/myapp.ear</workDirectory>
Set following attributes to WildFly with jboss-cli for JSP hot-deployment:
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=development, value=true) /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=check-interval, value=1) /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=modification-test-interval, value=1) /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=recompile-on-fail, value=true) :reload
Set following parameters to web.xml for JSF(XHTML) hot-deployment:
<context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>0</param-value> </context-param> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param>
REFRESH_PERIOD should be 2 (default) or something for production environment (filtering with maven might help). also it’s better to specify PROJECT_STAGE in JNDI.
Then configure your IDE.
for IntelliJ IDEA
-
Click the empty drop down list on upper right then select Edit Configurations…
-
Click "+" button on upper left then select JBoss Server ⇒ Local
-
Click "Fix" on the lower right then select an artifact which ended with "exploded"
-
Back to server tab and select desirable actions. I prefer "Update resources" for On frame deactivation because it enables that I can check modified JSP/XHTMLs with just press Command+Tab to switch to browser and reload immediately. I can trigger redeploy by hand with Command+F10 shortcut when I update some classes.
-
Now you can launch WildFly with the button on the upper right.
Refer http://jrebel.com for hot deployment of classes. it also offers free https://my.jrebel.com for personal, non-commercial use.
Fantastic tips, thank you very much for sharing.
Posted by Alexandre on March 28, 2015 at 10:01 AM JST #
Hi, thanks for the article!
I need to enable hot swap of my static resources. I have no JSPs but only files such as html, css, and Javascript (its a SPA). When I followed your directions and then tried to access my app I keep getting a FORBIDDEN response from the server. Any ideas how I can fix this?
Thanks!
Posted by Jeff Mitchell on December 23, 2015 at 11:14 PM JST #