There is new feature in NetBeans 6.5 that you can set up formatting settings per project. In previous releases there used to be only one formatting setting for whole IDE. Now you can work on several projects with different formatting. Or even better, you can share the settings with the whole team because it is saved in the nbproject/project.properties file of your project. This file is versioned by your version control system as it is part of the project.
If you want to set the "setting for specific project":
Samle of properties that appears in your project.properties
If you want to set the "setting for specific project":
- Open Project properties
- Click Formating category
- Select the "Use project specific options" radio button
- Don't forget to click OK when closing the dialog to save the settings ;)
Samle of properties that appears in your project.properties
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=4 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=trueNote: this is available from NetBeans 6.5!






A CheckStyle compliant import and export would be quite helpful!
Posted by jiai on September 30, 2008 at 12:13 PM CEST #
sounds great!
import and export would be great, because I have to manually enter everything each-time I download a new IDE version (and I don't want it to import ALL my previous settings..)
Posted by Michael Nischt on September 30, 2008 at 02:03 PM CEST #
Go ahead and fill new enhancements
Posted by Lukas on September 30, 2008 at 02:09 PM CEST #
Thanks, this is exactly what I needed to know. In retrospect, this is exactly how this should be handled.
Posted by Andrew Pitonyak on September 30, 2008 at 04:02 PM CEST #
I agree with previous postings.
Great but also having import / export is more important than setting per project, as I think even seems simpler and competes with feature already exists in eclipse from quite sometime.
I would appriciate to have import/export for formatting code in order to share with other developers rather than per project.
Posted by Ashraf Fouad on September 30, 2008 at 11:14 PM CEST #
You can import settings from another project, but you can not "export" the settings. It does, however, save the settings where you can trivially find them... This is probably sufficient.
Posted by Andrew D Pitonyak on October 01, 2008 at 01:24 AM CEST #
IMHO, Netbeans is always easy to use than eclipse. But for this feature, it has been asked in several forum. Anyway, I'm waiting for 15th Oct 2008 for official release of 6.5 and I will check with my team and will feedback u.
Posted by Ashraf Fouad on October 01, 2008 at 01:43 PM CEST #
@Ashraf: The release has been postponed to November - http://blogs.sun.com/coreqa/entry/netbeans_6_5_slips_for
@all: forums are nice but what counts are ENHANCEMENTs and ISSUEs filled in Issuezilla - http://wiki.netbeans.org/IssueReportingGuidelines. I'm sorry but information in a forum/list will get lost. In issuezilla (bug tracking system) it is tracked and can be assigned to developers. It can be included in plans and delivered. These are the reasons why I'm asking you to fill it into issuezilla. Thank you for understanding.
Posted by Lukas on October 01, 2008 at 02:16 PM CEST #
But for this enhancement-request we can assume that it has found it's way to the developers of this feature?
Posted by jiai on October 01, 2008 at 09:58 PM CEST #
I filed a bug report today, and it is already marked as fixed. I will test it from the nightly builds in the next day or two. I would say that they do listen.
Posted by Andrew D Pitonyak on October 02, 2008 at 05:14 AM CEST #
Thanks for great effort, I will keep watching this thread, maybe we will hear something great in the near future
Posted by Ashraf Fouad on October 02, 2008 at 12:56 PM CEST #
I am a team worker. now we use eclipse, and we define a codestyle and a code template that everyone need to follow. I really want to try NetBeans, but I have to make the code formatting exactly the same with my colleagues before I can check in a single code. So if Netbeans can import the code formatting from eclipse, it will be much easier for eclipse users to try it.
Posted by 80.202.241.75 on October 09, 2008 at 08:24 PM CEST #
is there a way to import/export the formatting rules in netbeans6.1?
Posted by Arno.Nyhm on October 14, 2008 at 01:43 PM CEST #
found a solution:
you can copy this file to others:
path:
%homepath%/.netbeans/6.x/config
subfolders:
/Preferences/org/netbeans/modules/java/source/CodeStyle
file:
default.properties
Posted by Arno.Nyhm on October 16, 2008 at 10:04 AM CEST #
Might be nice to warn when trying to change this global setting in NetBeans > Preferences that per-project settings are in effect. For example, setting the preference to "override global options" in the netbeans > preferences > editor > formatting tab (on os x, at least) has no effect when per-project settings are active. I only figured out how to get the required tab/space settings by finding this blog post and discovering there are yet more formatting options in my project which I guess trump the "global" options. (Not so global, are they :-)).
Posted by Ryan on March 19, 2009 at 08:50 PM CET #