Exclude files and directories from source control

You can configure the Eclipse integration to exclude specific files from source control. For example, Eclipse may ignore (exclude) your backup or temp files, which helps eliminate unnecessary files from your Dimensions CM project.

Methods for excluding files

The Dimensions CM for Eclipse integration has the following options for ignoring files from source control:

  • Standard Eclipse preferences

    The standard Eclipse preferences ignore files based on a global preference setting. The standard preferences use a pattern match to determine if files need to be ignored. The preferences automatically search any derived resources, however with some deficiencies. The standard preferences test only leaf names after containers have been expanded, which means that certain patterns aren't ignored as intended.

    Example: Specifying temp* ignores files called temp, temp.txt, temperance.txt, but it doesn't ignore files in a directory temp or any subdirectories of temp. Specifying temp.txt ignores it across all projects and directories though it may be necessary to ignore just one particular file with the name.

  • .dmignore file

    The .dmignore file ignores files and directories based on the entries in the file. This file contains project-specific ignore patterns which are used together with the standard preferences. The .dmignore file supports wildcards and pattern matching for both files and directories, and applies to all the files and subfolders in the folder in which it is located. It doesn't apply to subfolders.

    For example, .dmignore contains the entry temp* and you have the following structure:

    Copy code
    project
    .dmignore
    temp.txt
    temp/file1.txt
    dir1/temp1.txt

    In this case, the temp.txt file and the temp folder (and its subfolder) are ignored. The temp1.txt file is included because it is in a subfolder. To ignore this file, add another .dmignore file in the dir1 subfolder.

    To apply ignore rules recursively, add ’r:’. For example, to ignore all *.xml files in the current folder and all child folders:

    r:*.xml

    To clear all recursive rules inherited from parent .dmignore files, add ’c:’. For example, if a parent ignore file includes:

    r:*.xml

    and you add c: to the current ignore file, then all xml files in the current folder, and all child folders, are not ignored.

    Tip: Place the .dmignore files under source control.

    When you perform a source control activity, such as synchronizing a project, the integration runs the ignore checks based on the selection context. The following rules apply to the checks:

    • If a resource is under control, it is never ignored.

    • If a resource is linked, it is ignored.

    Note: If the user selects to add an 'ignored' resource to source control, the resource is added to source control. However, linked resources are hard ignored, meaning they cannot be added to source control.

Back to top

Exclude files using the .dmignore file

You can use the .dmignore file to exclude files from source control activities. This file can be used independently or in addition to the standard Eclipse ignore preferences.

Note: You can still explicitly add files to source control even though you have added them to the ignore lists.

To exclude files or folders using the .dmignore file:

  1. Right-click the file or file type, and select Team > Add to .dmignore.

    Choose to exclude this file only, all files with this extension, or the files that match a custom pattern. You can use wild cards such as asterisk (*) and question mark (?). You can also apply the rule recursively.

  2. Click OK. The entry is added to the .dmignore file in the root of your project. If the .dmignore file does not exist, the system creates it.

Or you can open the .dmignore file and add the entries there.

The .dmignore file applies to all files and directories at the same level as the file.

The file can contain an entry referencing itself, .dmignore. This prevents the file from being added to source control.

Back to top

Exclude files using standard Eclipse preferences

You can use the standard Eclipse preferences to exclude files from source control. The preferences can be used independently or in addition to the .dmignore file.

Note: You can still explicitly add files to source control even though you have added them to the ignore lists in Dimensions CM deployments opens in a web browser.projects.

To exclude files using the standard Eclipse preferences:

  1. In Eclipse, select Window > Preferences.

    The Preferences dialog box opens.

  2. Expand (Version Control) Team and select Ignore Resources.

  3. Examine the Ignore Patterns list for the file type you want to exclude from source control.

    If the file type is not listed, click Add. In the Enter Ignore Pattern dialog box, enter a pattern that defines a file type to ignore. You can use wildcards:

    • An asterisk (*) represents one or more characters.

    • A question mark (?) represents one character.

    Click OK.

  4. In the Ignore Patterns list, ensure that all the file types to be excluded from source control are selected.

  5. Click OK.

Back to top