NetBeans and Java: what to add to version control?

What do I need to add in addition to the obvious (src, dist) in my version control system from the NetBeans Java Project Directory? Can I delete the entire assembly directory? Should I add the nbproject directory as I am working on the same project on a different machine?

I would like to put at least the assembly directory, because when the application does not compile, I get problems with git, because there are not enough tons of files that git considers to be deleted.

+7
java git version-control netbeans
source share
5 answers

Note: this answer applies to NB 6.8 (which is exactly what I'm using now) and probably also applies to most 6.x versions that are likely to be there in the wild.

Short answer: use the menu item "Import to storage" to perform the initial check. The IDE will check the content that it believes is necessary.

This is a little hard to find. Select a project in the project explorer. Open the Command menu in the menu bar. As soon as you click on it, you will see something like:

Kenai> ------ CVS> Mercurial> Subversion> ______ 

Import to an element is a subclause of CVS / Mergcurial / Subversion.

If you are committed to completing the registration process, here is a list of the materials that the IDE usually places in the repository:

  • src dir (and all supporting files and folders)
  • test dir (and all supporting files and folders)
  • nbproject dir (and all files and folders - EXCEPT 'private' and its contents)
  • build.xml
  • manifest.mf
+6
source share

There is a similar question about Eclipse some time ago, and although some of the features of the IDE may be different, the principle is that introducing control into the version is the same.

Basically, everything that you do not generate.

Exceptions to this may be dependent jars. Whether you include them or not depends on whether you have a common library location that others can link to or not. As a habit, I always had environments with common places instead of keeping them under control for each project (after all, how many times do you want to keep log4j and your entire version under source control). Of course, we are now a maven user for this, so that the problem is resolved (see My answer regarding Maven and Eclipse in the same question that was mentioned above).

+2
source share

The repository should contain source code, resource files (images, configuration files, etc.) and build scripts (in Netbeans, all ant build files).

Do not put the dist / build directory. As a rule, it is not recommended to place the constructed artifacts (class files, project bank, etc.) in the original control.

However, sharing Netbeans metadata can come in handy when working on the same project from different computers.

+1
source share

You should put version control as much as possible. The pinnacle of that which does not change has zero value, understanding later that you cannot restore the state you need is fatal. Storage is very cheap, text files are very small, most SVM-s deadweight, which are small in size and speed.

Agile practices also explicitly include this. In addition to the source code and project files, consider building, deploying scripts, database schemas and layouts, configurations, documentation (!), Test files, dependent libraries, todos, the project website ... Of course, sometimes it can be difficult to place a virtual image machines running version (binary), conventional snapshots may be more applicable for this. But if you ever ask yourself, I have to put this under version control, the answer is almost always yes, you should. (Following this practice is also easier to make version control decisions.)

0
source share

Everything you need to create and launch a project from scratch.

Be sure to add your lib directory. I absolutely HATE THIS when I get things out of version control and all dependent jar files cannot be found, forcing me to keep guessing until I resolve all ClassNotFound exceptions. Do not add the assembly directory or assembly of the Netbeans script if you are not attached to working only with Netbeans. Another alternative is to add an assembly (non-Netbeans) script.

0
source share

All Articles