Putting a Project under Perforce Control

When you create an Eclipse project, make sure that the directory where its files reside is under the client root of the Perforce workspace associated with the Perforce server you intend to use to manage the project. Important: Keep the Eclipse workspace and the Perforce client workspaces separate, and do not place the Eclipse metadata files under Perforce control.

To put a project under Perforce control:

  1. In the Java perspective's Package or Navigator pane, right-click the project and choose Team>Share Project… The Share Project dialog is displayed.
  2. From the Repository Type list, choose Perforce and click Next. The Enter Perforce Server Connection Information dialog is displayed.
  3. Choose the connection for the Perforce server where you want the project to reside.
  4. Click Finish.
  5. In the Package or Navigator view, right-click the project folder and choose Team>Mark for Add... In the Package Explorer view, the files to be added are (by default) decorated with red plus signs. In the Perforce perspective, the files are listed in the P4 Pending Changelists view.
  6. To move files to a different changelist, click . On the Change Specification form, check the files that you want the changelist to include and click OK.
  7. Click OK.
  8. To submit the changelist, right-click it in the P4 Pending Changelists pane and choose Submit... The Perforce Change Specification dialog is displayed.
  9. Enter a description and click OK. The project files are added to the depot according to the settings you specified.

If you subsequently add files to the project, you must also add them to Perforce as described above or using the line item created under the Infos heading in the Problems View.

To add a file to the depot:

  1. Right-click the problem line item.
  2. Choose Quick Fix…
  3. Choose the Mark for Add fix. (To exclude the file from Perforce control and remove the task, choose Add to .p4ignore.)

NOTE: P4WSAD does not support deleting, moving, renaming, or refactoring linked resources (files and folders that are stored in locations in the file system outside of the project's location).

Excluding Files from Source Control

To conserve space in the repository and to keep changelists small, you can exclude individual files or file types (for example, build or release artifacts) from source control. Eclipse excludes a standard set of such files if you use the default Eclipse build output folder setup and global file type ignore features. If you need to go beyond the default—for example if you use a different builder or build output setup, or you intersperse temporary or other non-essential files with Perforce-managed files in your workspace—you can customize file exclusions using the approaches described in this section. Note that the different exclusion approaches operate independently. For example, if you exclude a file type using a .p4ignore file, you cannot override the exclusion by modifying the list of ignored resources in Preferences.

You can also exclude files from being submitted to the depot by modifying your Perforce client view to exclude the files. For details, refer to the discussion of "tight" client views in the Perforce System Administrator's Guide.

In general:

Important: you cannot exclude files after you have placed them under Perforce control. If you have files opened in a changelist and you want to exclude them from Perforce control, revert them from the changelist before excluding them.

Following are details:

To display label decorations for ignored files in the Navigator, choose Window > Preferences. On the Preferences dialog, go to Team > Perforce > Label Decorations and check Decorate files/folders contained in .p4ignore.

Copyright Perforce Software 2003-2009. All Rights Reserved.