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 ?
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.
*** Bug 188454 has been marked as a duplicate of this bug. ***
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.
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.
I have a related problem.
With a maven EAR project the auto-deploy functionality lost too.
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.
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!
>> Compile on save is a prerequisite feature for JRebel to work and it is
Sorry, I meant, compile on save is NOT a prerequisite feature for JRebel to work.
@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?
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.
@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.
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...
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
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.
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.
Maven EAR fix: 2981f8331406
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.
Integrated into 'main-golden', will be available in build *201011260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: David Konecny <firstname.lastname@example.org>
Log: #188361 - Support "Compile on Save" without automatic re-deploy
first part introducing API; will follow with clients in part 2
*** Bug 192907 has been marked as a duplicate of this bug. ***
The fix seems to fit what was needed, and appears to work as expected. Thanks David!
(In reply to comment #19)
> The fix seems to fit what was needed, and appears to work as expected. Thanks
Glad to hear that.