Adam Bien's Weblog

Tuesday Sep 06, 2011

Java EE Gems In NetBeans 7--Milliseconds Incremental Deployment

On every "save" NetBeans deploys your application behind the scenes in milliseconds. This works well with standard NetBeans Java EE projects (ant based), or with maven 3. Maven 3 projects can be also deployed in the "on save" fashion incrementally.

You only have to "Run" your application instead of "Clean and Build" or "Deploy" it. After an initial "Run" (right mouse click on project, then choose "Run") just saving a file causes an incremental redeployment of the application. It works in most of the cases, but sometimes you will have to "Clean and Build" your project. "Clean and Build" causes a recompilation and redeployment of the whole application - it is also fast (but application size dependent) and takes a few seconds.


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

I like this feature of seamless server integration. But whenever a java class file which is not a servlet is saved, then the entire application is undeployed and re-deployed which may take minutes. Of course then deploy on save is counterproductive. Do you know of any plans to support incremental deployment of ordinary class files?

Posted by Bernard on September 06, 2011 at 11:54 AM CEST #

I assume this is using Tomcat's or Glassfish's hot deployment right? This is kind of known to be memory leaky and error prone over time. for me, a more reliable method is to use JRebel.

Posted by Martijn Verburg on September 06, 2011 at 01:07 PM CEST #

In Your post I always see "how wonderful" this or other feature is, but real life shows that those features are minor, and do not works as described.

For this post I may only add that I have disabled this features, because NetBeans redeploys whole application on each save, this takes seconds not milliseconds, and I often save files

Posted by Anonymous on September 06, 2011 at 05:50 PM CEST #

@Bernard,

I measured the performance of incremental deployment in one of my "real" projects (several hundreds JPA entities) and it was really fast: http://www.adam-bien.com/roller/abien/entry/how_fast_is_the_build

thanks!,

adam

Posted by Adam Bien on September 06, 2011 at 05:59 PM CEST #

@Martijn,

you are right - JRebel is better. But NetBeans 7 with GlassFish 3.1.1 works really good. I'm using it in all my Java EE 6 projects. I could not identify any memory leaks with GlassFish so far.

However: I have no experience with Tomcat (too lazy for wheel reinvention :-)),

thanks,

adam

Posted by Adam Bien on September 06, 2011 at 06:03 PM CEST #

@Anonymous,

yes, real world is brutal :-). I measured the deployment performance of a real world application with several hundred JPA entities with NetBeans 6.1: http://www.adam-bien.com/roller/abien/entry/how_fast_is_the_build

If your deployment is slower, than in the case above, you should take a look at JRebel. It really rocks!

thanks!,

adam

Posted by Adam Bien on September 06, 2011 at 06:30 PM CEST #

Some weeks ago I tried to get this incremental deployment working with an EAR (WAR and EJB) application, created on Maven 3 in Netbeans 7.
Changing and saving something in the WAR did not end in a incremental deployment at all.
I googled about this and found other users having the same problem with EAR applications.
Have you ever encountered this issue?
Sorry, I don't know at the moment all the versions I was using then.

Posted by mcguppy on September 07, 2011 at 01:18 AM CEST #

Is it working for Spring3 based projects? I have trouble with this feature. I still see old code behavior until I kill Glassfish and redeploy/restart. I am running on Linux.

Posted by Eugene on September 07, 2011 at 07:01 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License