When synchronizing resources, often there are resources that you do not want to release to the stream. There are two ignore facilities provided that allow you to specify which resources should be excluded from catch up and release operations.
The first is a global ignore facility, provided by the workbench. The second is the CVS ignore facility, which reads the contents of the file .cvsignore to determine what to ignore. Use the global ignore for ignoring files that can appear anywhere in your project hierarchy. The CVS ignore facility provides compatibility with the existing CVS ignore files and is used most often to ignore directories.
1. |
From the workbench, select the Window > Preferences menu item. |
2. |
In the left pane of the preferences dialog, expand the Team category and select Ignored Resources. |
3. |
Click the Add... button and enter the following pattern *.obj. Click OK on the dialog. The ignore pattern will be enabled by default. All object files with extension *.obj will be excluded from release operations. |
4. |
Click the OK button of the preferences dialog. |
The Eclipse CVS client recognizes a file named .cvsignore in each directory of a project. This is a standard CVS facility and many existing CVS projects may already contain several of these files. This text file consists of a list of files, directories, or patterns. In a similar way to the global ignore facility, the wildcards "*" and "?" may be present in any entry in the .cvsignore file. Any file or subdirectory in the current directory that matches any one of the patterns will be ignored.
For example, add a .cvsignore file to ignore the entire Project/bin directory:
1. |
Select a project that contains a /bin directory from the Navigator. From the context menu select New > File. The bin directory will commonly contain the projects build output; these are files that are generated from the project's source files and are usually not version controlled. |
2. |
Enter .cvsignore as the file name, then press Finish. The file will be created in your project's root directory. You should see it in the Navigator. |
3. |
Double click on the file in the Navigator to edit the file. |
4. |
Enter bin in the .cvsignore file and save it. |
5. |
Select the project. From the context menu, select the Team > Synchronize with Stream menu item. Notice that the bin directory does not show as an outgoing addition. It is ignored. |
Let's say that the first time you synchronize your project with a stream, without adding ignore patterns first, you notice the bin/*.obj files and *.ba~ files appearing as outgoing additions. But you do not want these files to be synchronized. Here is how to ignore them once they already appear as outgoing additions:
1. |
From the Navigator view, delete the /bin directory and all the *.ba~ files. |
2. |
Create a .cvsignore file (File > New > File) in the parent directory of /bin, and add 'bin' to the file. Save the .cvsignore file. |
3. |
Create a global ignore entry (Window > Preferences > Team > Ignored Resources) with the following patterns *.ba~. |
4. |
Rebuild the project. From the workbench window, select the Project > Rebuild All menu item. |
5. |
Synchronize with the stream. In the context menu of the Navigator, select the Team > Synchronize with Stream menu item. The /bin directory and the *.ba~ files will not appear as outgoing additions. The .cvsignore file should be released to the stream. Others in your team will want to share this setting. |
If you use a global ignore for /bin, any resource that matches "bin" in any directory in the workbench will be ignored. Alternatively, the .cvsignore file will only apply the pattern to resources in the same directory as the .cvsignore file itself.