Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which NetBeans projects files should go into source control?

We normally use Eclipse for a particular Java project, but recently I imported the project into NetBeans to use its dialog building features.

Since I'll probably come back to this, I wanted to store the NetBeans project files into version control. However, I don't want to commit files that are "mine" versus "project", i.e., files with my own settings that would conflict with another user's.

NetBeans created the following structure in the top-level project area:

nbbuild nb-build.xml nbproject     <various files>     configs     private 

Clearly nbbuild is build output, so that won't go in. The nb-build.xml file seems likely, as does most of nbproject. However, nbproject/private suggests it's "mine". Peeking at "configs", it's not clear to me if that's mine or project...

Anyone have some guidelines?

like image 513
Peter Cardona Avatar asked Aug 12 '09 16:08

Peter Cardona


People also ask

Where does NetBeans store project files?

Under the project name that interest you, go in the "src" folder. All your java files should be there. Show activity on this post. On Ubuntu 16.04 using NetBeans IDE 8.2, a folder called NetBeansProjects was created in my root directory, parallel to the netbeans-8.2 directory.

What is nbProject folder in NetBeans?

The nbProject folder contains all the netbeans metadata about your project. When you go Project -> properties all the settings (and others) that you find there are stored in the nbProjects folder.

Where are JAR files stored in NetBeans?

A JAR file containing your project is created inside the PROJECT_HOME/dist folder. If you have specified any libraries for the project (in addition to the JDK), a lib folder is created in the dist folder.


2 Answers

The NetBeans knowledge base article on project files & version control discusses the NetBeans project files, with loose advice about which files are project specific (i.e. can be shared via version control), and which are user specific.

Here is the section on version control:

If the project is checked out of a version control system, the build (or nbbuild), dist (or nbdist), and the nbproject/private folders should not be checked into that version control system.

If the project is under the CVS, Subversion, or Mercurial version control systems, the appropriate "ignore" files are created or updated for these directories when the project is imported.

Though nbproject/private should be ignored, nbproject should be checked into the version control system. nbproject contains project metadata that enables other users to open the project in NetBeans without having to import the project first.

like image 132
Peter Cardona Avatar answered Sep 18 '22 10:09

Peter Cardona


It turns out that both Thomas & Petercardona are correct, in a way. NetBeans recommends that you only import source code and/or documentation. Oh and the nbproject folder but not the *nbproject/private** folders.

From the NetBeans Knowledge Base article on importing Eclipse projects:

Version Control Considerations

If the project is checked out of a version control system, the build (or nbbuild), dist (or nbdist), and the nbproject/private folders should not be checked into that version control system.

If the project is under the CVS, Subversion, or Mercurial version control systems, the appropriate "ignore" files are created or updated for these directories when the project is imported.

Though nbproject/private should be ignored, nbproject should be checked into the version control system. nbproject contains project metadata that enables others users to open the project in NetBeans without having to import the project first.

like image 30
Richard Hurt Avatar answered Sep 20 '22 10:09

Richard Hurt