views:

35

answers:

2

I'm working on a Java Netbeans 6.7 roject with a few developers and we're using Mercurial for version control. I was wondering what I should put in the .hgignore file (ie. what files should not be added to the repository). I know I will definitely want the src, test, and lib folders in the repository and the build folder to not be in the repository. But I'm not sure what to do about the nbproject folder.

+1  A: 

Anything that can be generated from what you check in should not be in the repository: no .class, .war, generated .jar, etc.

duffymo
Additionally, I prefer repositories to be clear of the files used by the IDE to structure the project. For example: IWS, IPR, and IML files used by IntelliJ; JCP, JCU, and JCW files for JCreator; etc. This lets separate developers on the project use their own IDE without being bothered by files exclusive to a different editor.
Brian S
Agreed, unless everyone is using the same IDE, at the same version. Then I might appreciate having them checked in.
duffymo
+2  A: 

If you have created these projects under an existing clone/repository, the NetBeans/Mercurial integration will already have a good idea of what to include or ignore.

NetBeans will automatically include files in nbproject that are considered to be environment independent. Files that include environmental dependencies (like directory paths) are usually placed in nbproject/private directory. You probably do not need to save those to your repo.

You may want to exclude the nbproject/build-impl.xml... it is generated when the project is opened... But, if you do not have it in your repo you will run into problems if you attempt to build the project with ant, independent of the IDE.

vkraemer
I originally initialized my project repository using TortoiseHG where I didn't know what files to add so I just added everything. I realize now that I should have initialized the repository within NetBeans so that it will take care of what files should and shouldn't be added.
MSumulong