News, updates, tips, tricks NetBeans Core QA

Wednesday Jul 23, 2008

Please, see update about this topis at "Build is not grey anymore"

Create new project in NetBeans IDE. Right click the project. The Build and Clean action is always grey out.
When you open an old project then it is there. So what is the magic here? Go to project properties, in category Compiling you'll find Compile On Save check box. When checked then the saved file is always compiled when you save it.


Are you interested in more details? Try it in latest builds or read the specification.
Comments:

Having compile on save is great and being able to turn it off is still better, because in the current implementation I have to do a Clean and Build to update the jars or wars generated by the build process, which may take a lot more time than just to compile one modified file and put that into the jar.

I think both menu entries should be active even with Compile on Save turned on.
What is the need to disable them?

Posted by Georg on July 23, 2008 at 05:03 PM CEST #

There is no need to have these menus when your build is always compiled. It would only confuse the users.

Posted by Lukas on July 23, 2008 at 05:13 PM CEST #

Yes you are right George, What is the relevant to make it Disabled.

It has been said "There are many different ways to skin a bugs<cat>"(joke...)

So give us different ways to build our projects.

Posted by Allen Montejo on August 01, 2008 at 05:16 AM CEST #

I just wish "deploy on change" on a VWP project didn't cause your session to be lost. I don't really want to have to relogin to my application every time I save a file in NetBeans.

Another feature that sounds promising but has no real use in the end...

Posted by Jeff on August 13, 2008 at 09:40 PM CEST #

I want to have "Compile single File" enabled, even if CoS is on.
Why:
1. I want to compile a single test class in "Test Packages" without having to run it.
2. I want to compile a single file, also if other files in the project have errors.

Posted by Ulf Zibis on August 22, 2008 at 02:17 PM CEST #

If Build menu item is to be greyed when compile on save is enabled, how you can I build the jar file from the IDE? Only the way that I know of is to do it for the cmd line using ant. Is that not a small step backwards?
How about changing Build to 'Build Jar' when compile on is enabled?
Or just simply don't grey it out as leaving it greyed is more confusing.

Posted by Harold on August 22, 2008 at 08:57 PM CEST #

When you need the jar (and it shouldn't be very often, right) then you have to use the Clean& and Build menu item. It will prepare jars into "dist" directory.

The CompileOnSave should save you time during development. Your code is always compiled and ready to run. Yes, there are some bugs in this feature right now but they should be fixed before 6.5 will be released.

Posted by Lukas on August 23, 2008 at 01:48 PM CEST #

Thanks Lukas...
when i first tried my project it... i thought greyed(build) option was a bug but after checking this post my doubt has been cleared...
And the compile on save option is a must active feature... A real time saver

Posted by Himanshu Bhardwaj on August 23, 2008 at 11:43 PM CEST #

The problem still remains that with CoS turned on you have to go through a complete build to create the contents of dist. If your project is large, this might easily outweigh the speed up achieved by CoS.

Anyway, in the daily from Aug. 31st the Build entry is enabled again, even with CoS turned on, but the build actions are sorted wrongly. Build must always be the first entry.

Posted by Georg on September 01, 2008 at 09:53 AM CEST #

Too optimistic. Instead of changing the behavior a #@%^&* dialog is shown. If I click Build, I just want NB to build the project as before CoS. I still do not understand, why CoS needs to be turned off to have Build enabled. (I have to turn off CoS on all of my 50+ projects...).

Good idea, bad execution.

Posted by Georg on September 01, 2008 at 09:56 AM CEST #

I notice that disabling compile on save is not available for web projects, just for a regular java application.

Posted by Kevin on September 07, 2008 at 09:17 PM CEST #

@Kevin: there is Deploy on Save for web apps - http://wiki.netbeans.org/NewAndNoteWorthyMilestone2NB65#section-NewAndNoteWorthyMilestone2NB65-DeployOnChange

You can turn it off, of course ;)

@George: wait, the new CoS feature is turned ON only for projects created in NB65. If you have OLD projects then the CoS will be OFF by default and you have to turn it ON when you want to use it.

Posted by Lukas on September 08, 2008 at 10:35 AM CEST #

@my last comment: I was wrong the CoS is ON even for old projects. You have to switch it off. All projects use the IDE default setting. For now it is CoS ON. It might change for 6.5. What is your preference?

Posted by Lukas Hasik on September 24, 2008 at 11:21 AM CEST #

I think, CoS should be disabled by default, at least for old projects.
Imagine, aircraft pilots would start training with auto-pilot on ?
Will say: Beginners should directly see and feel, what's going on.
... professionals shouldn't have to search for blogs like this, to find out how to dis/enable it, and how it works.
I suggest menu Run->"Enable Compile on Save" which should directly open Project Properties->Build->Compiling.
When CoS on, Build dialogue should additionally provide "Build JAR" without clean. It maybe should do the same than "Run", without run.

Posted by Ulf Zibis on September 24, 2008 at 05:42 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed