This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201106 - Show warning after changing 'Compile On Save' option - Clean and Build is required
Summary: Show warning after changing 'Compile On Save' option - Clean and Build is req...
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0.1
Hardware: PC All
: P4 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 16:40 UTC by Kynth
Modified: 2016-07-07 08:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kynth 2011-08-18 16:40:12 UTC
Expected Result:

- Saving a class should result in a build and deployment

Actual Result:

- JSP's are saved and deployed as expected
- Classes are saved but not deployed

Steps to recreate:

- Create a new Maven Web Application
- Run the webapp and select Tomcat 6 as the container to see the default Hello World! from index.jsp
- Edit the JSP and Save
- Refresh the Browser to see your changes
- Add a new RESTful Web Service (e.g. a Simple Root Resource from Patterns, default values result in a "GenericResource" class with a getXml() method)
- Edit the getXml() on GenericResource to return a string value (e.g. "Hello World!")
- Run the webapp to execute a Maven build
- Browse to your Web Service (/resources/generic by default) to see your string value
- Edit the string return value of getXml() and Save
- Expected result is to see you new string value, however nothing has changed
Comment 1 David Konecny 2011-08-18 21:38:47 UTC
Is the problem that classes under /resources/generic when saved are not compiled and redeployed but classes under src/main/java are?
Comment 2 Kynth 2011-08-18 21:52:46 UTC
I've retested and no classes under src/main/java in this scenario are being deployed when saved.
Comment 3 David Konecny 2011-08-18 22:42:50 UTC
If I remember well there are two options on project which has to be set on: "Compile on Save" and "Deploy on Save". Are both of these set to true? I do not have IDE in front of me but one option is somewhere in compilation panel and other in run panel in project properties.
Comment 4 Kynth 2011-08-19 08:34:21 UTC
In the Project Properties, under 'Build > Compile > Compile On Save', the option is in the form of a drop-down and was tested originally with the 'For test execution only' option selected (the default). 

I have retested and no deployment occurs with any of the options selected (including the 'Disabled' option, but that's to be expected!).

In the Project Properties under 'Run > Deploy on Save', the option is a greyed-out check-box (but it is still ticked) when the previously mentioned 'Compile on Save' drop-down is in the default 'For test execution only' setting.

The 'Deploy on Save' check-box becomes enabled when the 'Compile on Save' drop-down is set to 'For application execution only' or 'For both application and test execution' allowing you to tick/un-tick the check-box.

I have retested by toggling the 'Deploy on Save' check-box on and off with these two 'Compile On Save' options set but there is still no automatic deployment on save unfortunately.

The workaround is to Run the project (I normally use F6 for this) in order to compile and deploy to your local container (currently Tomcat 6 for me), though it's a little awkward when you're in mid-flow.
Comment 5 Kynth 2011-08-19 08:52:06 UTC
With 'Properties > Build > Compile > Compile On Save' to 'For both Application and test execution' and making sure 'Properties > Build > Compile > Deploy on Save' is both enabled and ticked.

I then performed a Clean and Build followed by a Run. 

Classes are now compiling and deploying (so I'm happy).

I've retested this with a fresh project and it seems that you must do a Clean and Build after setting the 'Compile On Save' and 'Deploy on Save' options appropriately.

I'm not so sure if this is an actual issue now or whether it's just a case of I'm not expecting to need to change the project defaults and run a Clean and Build for this functionality.

If it's not just me (paranoia alert!) and others are running into this scenario, perhaps setting the 'Compile On Save' option to 'For both Application and test execution' as the default option for a new Maven Web Application instead of 'For test execution only' would help?

Assuming this doesn't create further complications of course.
Comment 6 David Konecny 2011-08-24 22:16:22 UTC
OK, this make sense and should be fixed or user should be somehow warned. I think I bumped into it once myself.

(In reply to comment #5)
> [...] perhaps setting the 'Compile On Save' option to 'For both Application
> and test execution' as the default option for a new Maven Web Application
> instead of 'For test execution only' would help?

This is good idea regardless of this problem - to set CoS and DoS by default to true.
Comment 7 Martin Janicek 2011-10-20 15:36:30 UTC
Default values of CoS and DoS has been already set to true in issue 203066. If I'm getting this right, the only thing that needs to be done is show some warning that user needs to rebuild application when changing one of these values?
Comment 8 Martin Janicek 2011-11-11 10:43:46 UTC
Changing priority to P4 and title to reflect current state
Comment 9 Martin Balin 2016-07-07 08:55:24 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss