Defining Perforce Server Connections and Working Offline

Defining Connections

Connections enable you to browse the Perforce server to import projects and obtain access to files under Perforce control. You define connections in the P4 Connections view of the Perforce perspective. To define a connection, you specify the server host and port, your Perforce user name, and the name of the Perforce client workspace associated with your Eclipse project.

To define a connection:

  1. In the Perforce perspective's P4 Connections view, right-click and choose New Connection... The Perforce Server Connection Wizard is launched. (Alternate menu choice: File > New > Other > Perforce > Connection)
  2. On the first pane, enter the connection settings and click Next.
    Connection settings:
  3. On the second pane, choose or create a Perforce client workspace to be used in association with the specified server.
  4. Click Finish. Your newly-defined connections is listed in the P4 Connections view.

Workspaces: Perforce vs. Eclipse

Both Perforce and Eclipse define workspaces, that is, managed directories that contain local copies of files. Eclipse projects that are managed by Perforce must reside under the client root directory. To ensure that you do not check in machine-specific Eclipse files (which create problems for other developer who import your projects), keep the Eclipse and Perforce workspaces separate, that is, ensure that neither workspace resides inside the other.

When you create new projects that you intend to check into Perforce, you must override the Eclipse default location (the Eclipse workspace) and specify a location in the Perforce workspace.

The Perforce client workspace is configured by editing its client specification. To edit the client specification, right-click the corresponding connection in the P4 Connections view and choose Edit Perforce client...

Working Offline

If P4Eclipse cannot connect to a Perforce server to perform an operation, it displays the following prompt:

To continue with the current connection settings, click Work Offline. If you work offline, you must reconcile any changes you make with the Perforce depot when the server connection is restored. You must add newly-created files, check in changed files, and delete files from the depot that you have deleted from the project. To detect files that differ from the depot, right-click the project in the Navigator pane and choose Team > Check Consistency...

If you have chosen to work offline, note that, by default, P4Eclipse retries the connection the next time you launch Eclipse. If you expect to work offline for an extended period of time, you can disable the retries (and the resulting error messages) by enabling the Team > Perforce preference Retain offline connection state between Eclipse sessions.


Copyright Perforce Software 2003-2010. All Rights Reserved.