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 uses a pattern match to determine if files should be ignored. The preferences automatically searches any derived resources, however it has some deficiencies. The standard preferences test only leaf names after containers have been expanded, which means that certain patterns will not get ignored as intended.

    For example, specifying temp* will ignore files called temp, temp.txt, temperance.txt, but it will not ignore files in a directory temp or any subdirectories of temp. A second limitation is that specifying temp.txt will ignore it across all projects and directories. 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 specified in the file. This file contains project-specific ignore patterns which will be used in addition to the standard preferences. The .dmignore file supports wildcards and pattern matching for both files and directories, and applies to all the files and directories in the folder in which it is located. It doesn't apply to subfolders.

    For example, if .dmignore contained the entry temp* and you had the following structure:

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

    the temp.txt file and the temp folder (and its subfolder) would be ignored. The temp1.txt file would be 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 will never be ignored.

    • If a resource is linked, it will be 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, it will be created.

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. Select Window > Preferences.

    The Preferences dialog box opens.

  2. Click the plus sign next to Team, and select Ignore Resources.

  3. Examine the Ignore Patterns list for the file type you wish 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:

    • Asterisk (*): represents one or more characters.

    • Question mark (?): represents one character.

    Click OK.

  4. In the Ignore Patterns list, ensure that a checkmark is displayed next to each file type to be excluded from source control.

  5. Click OK.

Back to top