Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 188361 - Support "Compile on Save" without automatic re-deploy
Support "Compile on Save" without automatic re-deploy
Status: VERIFIED FIXED
Product: javaee
Classification: Unclassified
Component: Maven
6.x
All All
: P3 with 7 votes (vote)
: 7.0
Assigned To: David Konecny
issues@javaee
:
: 188454 192907 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-04 19:02 UTC by jon_c
Modified: 2010-12-08 00:53 UTC (History)
7 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jon_c 2010-07-04 19:02:15 UTC
As best I can tell, there is currently no way to prevent Netbeans from doing a deploy when the 'Compile on Save' feature is enabled on a Maven web project. For those who apply incremental changes using a framework such as JRebel, this is a major nuisance; changing certain files that JRebel can dynamically reload (e.g. a Spring configuration file) end up causing a full restart of the application.

I've addressed this problem for myself by patching the tomcat plug-in to be able to toggle deploy-on-save on/off as a Deployment option. A more generic solution controlled on a per-project basis (rather than on the web server) would be useful in my opinion. Perhaps just a flag in Project Properties -> Build -> Compile ?
Comment 1 TheJuice 2010-07-07 15:27:57 UTC
I have the same problem and situation, except I use GlassFish. As jon said, a simple flag in the compilation properties to disable Deploy on save would be great.
Comment 2 TheJuice 2010-07-07 19:25:06 UTC
*** Bug 188454 has been marked as a duplicate of this bug. ***
Comment 3 mblok 2010-08-10 06:30:10 UTC
Same problem over here. I cannot use JRebel to automatically update my war file on Glassfish 3. A simple option to only compile on save instead of deploy on save would be very nice to have, and would save lots of time.
Comment 4 johnpanelli 2010-10-21 00:31:05 UTC
I have the same situation, but I do not use Maven.  I want to be able to use JRebel with NetBeans 6.9 and Glassfish 3.0.1 such that I can edit a file, save it and have JRebel automatically reload it into the VM.  So far, I am unable to get this working.
Comment 5 kumm 2010-10-22 15:28:26 UTC
I have a related problem.

With a maven EAR project the auto-deploy functionality lost too.
http://netbeans.org/bugzilla/show_bug.cgi?id=177230

I tried JRebel with no success.
All Compile On Save options 'For ***** EXECUTION' are meaningless on the submodules (WAR, and EJB) because EAR is under execution. 
And without the compile on save JRebel has no chance.

In this case allowing the compile on save WITHOUT execution, would be necessary to use JRebel.

And without auto-deploy, but that part is ok, because of the other bug :)

I use netbeans 6.9, tried 7.0M2, but still no luck.
Comment 6 arhan 2010-10-22 21:09:28 UTC
Hi,

There's no "compile on save" in IDEA, for instance, and JRebel works well there. Compile on save is a prerequisite feature for JRebel to work and it is actually IDE-agnostic.

Once you start your application (in tomcat or any other container) you will make the changes in the code or any of your artifacts, and the only thing you need to do is just to re-compile the changed class - you do not have to do "mvn compile" etc to update your application.

See, JRebel doesn't monitor for src/, but it monitors for the compiled classes.

@mblok. @johnpanelli. you probably would just need to include the correct rebel.xml file to your war and compile the changed classes to the correct location pointed by rebel.xml

@kumm with EAR deployment you need to have rebel.xml for each of its subarchives. E.g. war has to have its rebel.xml, ejb-jar has to have its rebel.xml, etc.

Please, refer to the reference manual here: http://www.zeroturnaround.com/reference-manual/app.html#app-2.1 

If you have troubles, please ask at our forum. We're happy to help!
Comment 7 arhan 2010-10-22 21:17:30 UTC
>> Compile on save is a prerequisite feature for JRebel to work and it is
actually IDE-agnostic.


Sorry, I meant, compile on save is NOT a prerequisite feature for JRebel to work.
Comment 8 jon_c 2010-10-22 22:06:52 UTC
@arhan I certainly recognize that Compile-On-Save is not mandatory for JRebel to work, but a seamless experience between the IDE and deployment tool certainly goes a long way towards a positive development experience. Netbeans doesn't achieve this out-of-the-box; why can't I just have it compile my files as I save them *without* reloading my entire web-app for me? Perhaps I am approaching this from the wrong end though; it's certainly in ZeroTurnaround's best interest to work well with mainstream IDEs. Perhaps the JRebel plug-in for Netbeans could be enhanced to support this somehow instead of trying to get this into a Netbeans release?
Comment 9 arhan 2010-10-22 22:25:42 UTC
@jon_c

We surely are interested. 

Currently, the documentation is being updated, so probably it will clarify some of the issues. But I have to admit that NetBeans' support haven't been the priority.

But basically, what do you want to archive, is what I've just said - just re-compile the changes and see them in the application instantly. And that is achievable now with NetBeans and JRebel. What you need to do is to tell to NB not to re-deploy the application after re-compile. (I'm not an active NB user so I'm just guessing here, if that's the case). So once you re-compile a class it is fetched by JRebel and propagated to the app. That's it, I see no problem here.
Comment 10 jon_c 2010-10-22 23:21:06 UTC
@arhan I'll try to clarify my goal and the purpose of this ticket. My goal is to avoid lengthy re-compiles as part of  development/test iterations; "just re-compile the changes and see them in the application instantly" isn't so simple when your application takes more than a minute to compile. Avoiding redeploys is only half the battle! The best way to achieve this is to have only modified files compiled as they are being updated (this is the idea of Compile-On-Save, right?). The problem is that Netbeans doesn't *actually* support "compile-on-save" with Maven projects; what is called "compile-on-save" actually acts as "compile-and-redeploy-on-save". Obviously, having the application fully redeployed by Netbeans defeats the purpose of JRebel completely.

Yes - I can use Netbeans out-of-the-box + JRebel. Just not very effectively.
Comment 11 johnpanelli 2010-10-22 23:31:54 UTC
I have to agree.  I think the JRebel guys need to sit down with NetBeans and go through the motions.  For example "What you need to do is to tell to NB
not to re-deploy the application after re-compile" is an easy statement to make, but it isn't easy to accomplish.  Exactly how do you do this?  I have not found a way myself because compile on save really is compile-and-redeploy-on-save.  If the JRebel plugin can override that behavior, that might work, but NetBeans needs to be a priority first...
Comment 12 arhan 2010-10-23 00:36:38 UTC
@jon_c

probably with Maven project, you better use JRebel maven plug-in (http://www.zeroturnaround.com/reference-manual/app.html#app-2.4) and not to use mvn compile..

I see what you mean. I have tried to use NetBeans+JRebel myself (http://vimeo.com/16108288) and indeed - too many motions. Just a matter of automating it by a plug-in, like in case of Eclipse+JRebel or IDEA+JRebel
Comment 13 David Konecny 2010-10-26 11:22:51 UTC
Thanks for the report. Me or Petr Hejl will have a look at it on NetBeans side and will try to fix it ASAP. The fix should allow to disable auto redeployment while still keeping auto compilation after save.
Comment 14 David Konecny 2010-11-18 22:54:02 UTC
API disabling deployment part was added: fbf54cded2eb
Ant projects were fixed: d709049172e6
Maven projects were fixed: a6188eab3836

I need to test it now little bit more and will push to central repo early next week. Basically all projects now have "Compile on Save" option in their Compilation project properties and "Deploy on Save" in Run properties and these two options allow to turn on only CoS without DoS. But of course not vice versa as that does not make sense.
Comment 15 David Konecny 2010-11-24 02:07:51 UTC
Maven EAR fix: 2981f8331406
Comment 16 David Konecny 2010-11-24 22:03:41 UTC
This should be available in nightly builds later this week (Fri/Sat). I would
appreciate if somebody could verify it works as expected.

The UI and wording might need improvement but apart from that I think everything works. I added a new checkbox to "Run" panel in project properties (all Maven and Ant project types) which is labeled as you might expect "Deploy on Save". That and "Compile on Save" (located as before in Compilation panel) will allow you to switch on CoS but disable DoS.
Comment 17 Quality Engineering 2010-11-26 06:12:22 UTC
Integrated into 'main-golden', will be available in build *201011260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/fbf54cded2eb
User: David Konecny <dkonecny@netbeans.org>
Log: #188361 - Support "Compile on Save" without automatic re-deploy
first part introducing API; will follow with clients in part 2
Comment 18 David Konecny 2010-12-07 22:57:02 UTC
*** Bug 192907 has been marked as a duplicate of this bug. ***
Comment 19 jon_c 2010-12-08 00:15:08 UTC
The fix seems to fit what was needed, and appears to work as expected. Thanks David!
Comment 20 David Konecny 2010-12-08 00:53:02 UTC
(In reply to comment #19)
> The fix seems to fit what was needed, and appears to work as expected. Thanks
> David!

Glad to hear that.


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