Hot Deployment of a Web Application with Maven in NetBeans

by Hubert A. Klein Ikkink; first published in blog

When I am working on a web application I normally start Tomcat with mvn tomcat:run, change my source file (for example a JSP file), run mvn war:exploded to get the changed file in Tomcat and refresh my page in my web browser. And then I get to see my changed JSP.

Today I was working on a Maven based web project in NetBeans. I changed something in my JSP file, but I forgot to run mvn war:exploded before I refreshed the web page in my web browser. But to my surprise the change was already there on my screen. NetBeans had already copied my changes so Tomcat could picked it up. Wow! This really speeds up my development by factors and I didn't have to do anything to make it work.

This is only the case with jsp files, not working with classes (on Tomcat) even though I've set compile on save on my web project. It seems like it compiles the class and puts it in the target/classes folder, without updating the target/MyWebApp dir. I've also tried to manually copy the compiled class into this dir while tomcat is running, but nothing changes until I restart the tomcat.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo