Putting a Project into CVS


When you create a NetBeans project for your source files, the IDE creates a build script, properties files, and other project metadata for the project in your project folder. See Inside the Generated Build Scripts in Chapter 3 for a full description of the project metadata files. In addition to sharing your source files, you can also check the project metadata into CVS. Other developers who use NetBeans IDE can then check out the project and start working with it immediately without having to configure their own project. This is especially important for free-form projects, for which you have to write your own Ant targets to do things like running the project in the debugger.

One of the most important parts of adding projects to CVS is making sure that references to resources, such as JAR files on the classpath, source folders, and other projects, are correctly defined. If these references are not correctly defined, the project will build fine on your machine but not build or run correctly when other users check the project out of the repository.

Normally, NetBeans IDE stores resource references using absolute paths in the nbproject/private/private.properties file. You should never add the /private folder to the CVS repository, as it defines local properties that are different on each machine. When a project that has resource references defined in this way is put into CVS, each user who checks the project out must specify the location of the references on his or her machine.

If, however, you create a project in an existing CVS working directory, the IDE automatically uses relative links to all resources in the same CVS working directory. These relative links are defined in project.properties, which is checked into CVS and is shared by all users. As long as the projects and resources have the same relative location in the repository, no further configuration is needed.

The IDE automatically excludes the nbproject/private folder, as well as the build and dist folders, from all CVS commands. If your project already has references defined with absolute paths defined in private.properties and you want to check the project into CVS, you can manually delete the references in private.properties and define them with relative paths in project.properties.


The recommended method of creating projects that are going to be checked into CVS is therefore as follows:

1.

Create a repository if it does not already exist.

2.

Check out the root of the repository by leaving the Modules to Check Out field empty in the CVS Checkout wizard.

3.

Create the projects in the working directory to which you checked out the repository root. The IDE automatically schedules all the new files for addition to the repository.

4.

Right-click each of the projects and choose CVS | Commit.

If you are only checking in one project or do not want to check out the entire root of your repository (which can sometimes contain too many files to manage effectively), you can right-click an individual project and choose CVS | Import into CVS. The IDE imports the project and then checks it out again, turning its location into a CVS working directory.

Resolving Merge Conflicts in Project Metadata Files

If your project's properties are modified by two or more developers simultaneously, merge conflicts can occur when you update your project from your version control system.

If merge conflicts occur in project.xml or project.properties, you should be able to resolve them manually in the Source Editor.

Should a merge conflict occur in your build-impl.xml file (which itself would probably be a result of a merge conflict in the project.xml file), do the following:

1.

Resolve the merge conflict in the project.xml file and commit the change.

2.

Delete the build-impl.xml file.

3.

In the Projects window, right-click the project's main node and choose Close Project.

4.

Reopen the project by choosing New | Open Project. The build-impl.xml file will be regenerated when you reopen the project.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net