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:
- Go to Project -> Properties -> Build -> Compile
- Change the Compile On Save setting to "For application and test execution"
Posted at 10:38AM Jun 20, 2011 by Adam Bien in Real World Java EE Patterns - Rethinking Best Practices | Comments[14] | Views/Hits: 18159
NEW Workshop: "JPA, NoSQL, Caching, Grids and Distributed Caches with Java EE 7", May 7th, 2013, Airport Munich
A book about rethinking Java EE Patterns
Tweet Follow @AdamBien

Very, very cool.
Posted by umpirsky on June 21, 2011 at 04: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 09:37 PM CEST #
Is this similar to an Eclipse deploys to Tomcat?
Posted by Jonathan Fisher on June 21, 2011 at 11:49 PM CEST #
@Umpirsky,
indeed - one of my NetBeans favorites.
thanks!,
adam
Posted by Adam Bien on June 22, 2011 at 10:45 PM CEST #
@Nowaker,
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...
thanks!,
adam
Posted by Adam Bien on June 22, 2011 at 10:46 PM CEST #
@Jonathan,
similar to GlassFish Plugin on Eclipse. It works, however, with standard Maven 3 project without any modifications.
Just try it!,
adam
Posted by Adam Bien on June 22, 2011 at 10:48 PM 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 11:47 AM CEST #
@Laurence,
on each Maven project. It is a project setting.
Just try that :-)
adam
Posted by Adam Bien on June 23, 2011 at 08:30 PM CEST #
@adam it worked in previous NB releases! just use jetty plugin ;)
http://stackoverflow.com/questions/2844135/which-java-web-frameworks-provide-hot-reload/3668180#3668180
Posted by Peter on June 24, 2011 at 11:41 PM 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 06:32 PM CEST #
@Martin,
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?
thanks!,
adam
Posted by Adam Bien on June 30, 2011 at 12: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:
http://www.java.net/forum/topic/glassfish/glassfish/how-achieve-incremental-deployment
best regards
Daniel
Posted by Daniel on July 09, 2011 at 11:09 AM 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 05:46 PM CEST #
Hi, I've got an issue with hot deployment described here:
http://stackoverflow.com/questions/9547017/netbeans-maven-aspectj-compile-time-weaving
Basically, my hot deployment with CTW isn't working.
Posted by Mircea Deaconu on March 04, 2012 at 12:19 PM CET #