Tip: "Unset as Main Project"

A strange thing to get used to in NetBeans is when you're in this situation:

Above, the "GUIFormExamples" project is bold, i.e., it is the main project. Hence, when "Run Main Project" (and other "Main Project" buttons) is clicked in the toolbar, the "GUIFormExamples" is run, even though the "AnagramGame" project is currently selected.

Wouldn't it be better if the currently selected project were to be the main project? The whole concept of a "main project" is needlessly confusing. The main project should simply be the currently selected project and if the cursor is currently in an editor document, then the related project should automatically be the main project.

Now here's a simple workaround to achieve the above (thanks to developers in Norway who told me about this):  right-click the "GUIFormExamples" above and choose "Unset as Main Project". Now there are no main projects and the currently selected project is run when you choose "Run Main Project" and, similarly, when an editor document is open, the related project is run.

A related issue: http://netbeans.org/bugzilla/show_bug.cgi?id=166780

Comments:

Hello Geertjan!

I wouldn't consider the "Main Project" feature as entirely useless and confusing. Imagine the situation when you are working on a complex Netbeans RCP Project which depends on an external library which is wrapped by a Library Wrapper Module. It's very convenient when you can then, after manipulation the library and compiling it, just hit the run button and the module suite starts up. Therefore I appreciate this main project functionality.

Best Regards,

christian

Posted by t3chris on November 07, 2011 at 06:41 PM PST #

Same feeling here: set/unset main project is a bonus for me.
Another use case from real life:

1) a JEE project
2) a JSE project using interfaces from 1) to interact with the running JEE instance

Most of the time I need to edit 1) and inspect 2). Selecting every time 2) to run it is a waste of time.

Ciao,
Sergio

Posted by sergio on November 07, 2011 at 07:45 PM PST #

To Christian and Sergio -

the suggestion is not really to kill the main project concept completely, rather, it's a question of the default behavior. I believe in most situations, Main project is unnecessary and confusing, and by default, no project should be set as main, leading to the "current project" behavior. However, you would still have the option to set any project as main, which would achieve the behavior you need.

Posted by Petr Jiricka on November 08, 2011 at 02:08 AM PST #

Wow!! This unset functionality is sexy. Haven't really taken note of it till I read this blog post. NetBeans never cease to make developers life easier.

Posted by guest on November 08, 2011 at 01:59 PM PST #

Here's my tip: For me, the biggest aid for managing many projects has customizing the toolbar by adding the following buttons: Build Project, Clean/Build Project, and Run Project. These new buttons are in addition to the default buttons that operate on the main project. With these, I can easily invoke the desired operation on either the selected project or the main project (typically a suite).

Posted by Bruce Schubert on November 09, 2011 at 12:17 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today