Adam Bien's Weblog

Maven 3 Milliseconds Deployment ...with NetBeans 7 and Java EE 6

NetBeans 7 supports hot deployment of Java EE 6 Maven based applications ...out of the box. You only have to activate that:

  1. Go to Project -> Properties -> Build -> Compile
  2. Change the Compile On Save setting to "For application and test execution"

Now on every save your application gets deployed in background - as usual in milliseconds.

NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.


A book about rethinking Java EE Patterns


Very, very cool.

Posted by umpirsky on June 21, 2011 at 06:02 PM CEST #

As far as I can remember, "compile on save feature" (which with appserver configured in NetBeans means "compile and redeploy on save") has been there since NetBeans 6.7 or 6.8. However, these weren't milliseconds to redeploy so I switched to JRebel. Did they improve it in 7.0?

Posted by Nowaker on June 21, 2011 at 11:37 PM CEST #

Is this similar to an Eclipse deploys to Tomcat?

Posted by Jonathan Fisher on June 22, 2011 at 01:49 AM CEST #


indeed - one of my NetBeans favorites.



Posted by Adam Bien on June 23, 2011 at 12:45 AM CEST #


Deploy on save worked also in previous versions of NetBeans - but not with Maven 3. It only worked with internal ant build (=NetBean's default project).

Now it works with default Maven 3 projects without any modifications -> really impressive...



Posted by Adam Bien on June 23, 2011 at 12:46 AM CEST #


similar to GlassFish Plugin on Eclipse. It works, however, with standard Maven 3 project without any modifications.

Just try it!,


Posted by Adam Bien on June 23, 2011 at 12:48 AM CEST #

If building a Maven Enterprise Application does one have to set this setting on each component, such as ejb and web, or just the Maven component?

Posted by Laurence on June 23, 2011 at 01:47 PM CEST #


on each Maven project. It is a project setting.

Just try that :-)


Posted by Adam Bien on June 23, 2011 at 10:30 PM CEST #

@adam it worked in previous NB releases! just use jetty plugin ;)

Posted by Peter on June 25, 2011 at 01:41 AM CEST #

Just want to bring a flaw in the "compile on save feature".
We have a OpenJPA plugin to enhance classes during process-classes phase.
However, with the "compile on save" being enabled, those enhanced classes get overwritten by this feature. So when we run Integration tests, we have to disable this feature for the tests not to fail in the netbeans ide.

Posted by Martin jamszolik on June 27, 2011 at 08:32 PM CEST #


thanks for testing. I'm running my integration tests with mvn failsafe:integration-test. I configured it with a custom action. Does it not work in your case?



Posted by Adam Bien on June 30, 2011 at 02:52 AM CEST #

Hi Adam,

im very interested in a fast deployment for development, too! We're also using maven3.

What is netbeans doing/calling to incrementally deploy e.g. one ejb module of an ear? (We need this whitout netbeans, too.)

The the documentation says:
- "redeploy"
- "touch"
This redeploys/reloads the whole ear!?

These approaches are quite slow - much slower than netbeans "incremental deploy".

I asked in the forum, too:

best regards

Posted by Daniel on July 09, 2011 at 01:09 PM CEST #

Is your Main Project set to the EAR or the Web App. When I set mine to EAR, my project come up as expected. However it will not auto deploy any changes to my web app. If I try to set my Web App to the main project, it fails due to a dependency of an EJB. I have tried to solve this for a few days, but no luck. Just wondering if your Web app had a dependency on a EJB. Also can you auto deploy a Web App by launching the project via the EAR. TIA

Posted by John Sarman on July 17, 2011 at 07:46 PM CEST #

Hi, I've got an issue with hot deployment described here:

Basically, my hot deployment with CTW isn't working.

Posted by Mircea Deaconu on March 04, 2012 at 01:19 PM CET #

Hi Adam,

it's really nice that this feature works. Which APP-Server you are using. We are switching from GlassFish 3.1 to JBoss EAP in production.

Many of the core functionalities works like, deployment and debugging direct from IDE.

I'm working on a new project with JSF and PrimeFaces. Before switching to JBoss I could edit static CSS files and used compile on save. The IDE makes a hot deployment I think. Do you know if there is a similar function in NetBeans > 7.4 and JBoss EAP.



Posted by Adem on December 30, 2014 at 05:05 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments