Saturday, December 08, 2007

Instaling and Configuring the Perforce Eclipse Plugin

A few clients I've had this year use Perforce for source control. I didn't find the official Perforce Eclipse plug-in installation notes detailed enough, so here is my version:


1. If you haven't got the Perforce client already installed (the Eclipse plug-in uses the p4.exe command-line tool) then download it from here and install.

2. Create a Perforce workspace for your project.

Eclipse Install and Configuration

1. If you are behind a corporate firewall configure Eclipse to use the firewall HTTP proxy. Proxy configuration steps vary with the version of Eclipse, but for Eclipse 3.1 it is :

a. Windows > Preferences > Internet > Proxy Settings
b. Check Enable Proxy
c. Type in the Proxy host and Proxy port
d. Click OK

2. Add the Perforce plug-in remote site

a. Help > Software Updates > Find and Install
b. Click “Search for new features to install” > Next
c. Click “New Remote Site
d. In the dialog box enter

Perforce Plugin

for “Name” and

for “URL” > OK
e. Click Finish

3. Download the plug-in

a. Check the “Perforce Plugin” checkbox > Finish

b. Check the “Perforce Plugin” checkbox > Next

c. Click “I accept the terms in the license agreement” radio button > Next

d. Accept the default plug-in install location by clicking Finish

e. Click Install All

f. Click Yes when asked if you want to restart Eclipse

4. Enable label decorations

a. Windows > Preferences > General > Appearance > Label Decorations
b. Check “Perforce” > OK

5. Configure your favorite Perforce Label Decorations

a. Windows > Preferences > Team > Perforce > Label Decorations
b. Select the decorators and decorator locations from the "File Decoration Icons" combo boxes
c. Click OK

6. Configure Eclipse to point to the p4 executable

If the Perforce p4.exe command-line tool is not in your PATH then you will need to explicitly set the location of it.

a. Windows > Preferences > Team > Perforce
b. Click the "Location" radio button
c. Enter the full path to the p4.exe in the text box e.g. C:\Program Files\Perforce\p4.exe
d. Click OK

7. Configure your project to point to your Perforce workspace

a. In the Eclipse project hierarchy right-click the name of your project > Team > Share Project…

b. Click “Perforce” > Next

c. Enter the PERFORCE_SERVER_NAME:PERFORCE_SERVER_PORT for “Port”, the Perforce user name for “User” and Perforce workspace for “Client Workspace” > Finish

Recovering Your Eclipse Workspace

One situation you're likely to come across when using the Perforce plug-in is this: if Eclipse does not shut down properly (e.g. Eclipse crashes or your PC did a forced reboot) then chances are pretty good your Eclipse workspace will be corrupted.

The symptom of this is that when you try to start Eclipse the splash screen will appear, then disappear and then nothing happens. i.e. Eclipse fails to start. You can verify the cause by looking for Perforce plug-in failure messages in the WORKSPACE_DIR/.metadata/.log file.

There are two solutions to this:

1. Re-create your workspace from scratch, which can take a while.
2. Manually uninstall and re-install the Perforce plug-in.

To manually uninstall and re-install the Perforce plug-in do the following:

i. Exit Eclipse if it is running.
ii. Move the sub-directories beginning with com.perforce found in ECLIPSE_INSTALL_DIR/plugins to a temporary directory (e.g. c:\Temp). In the version of the Perforce plug-in I installed these sub-directories are named

  • com.perforce.p4api_2006.2.4136
  • com.perforce.p4wsad_2006.2.4136

iii. Start Eclipse, let it load the workspace, then exit Eclipse normally
iv. Move the Perforce plugin sub-directories back to ECLIPSE_INSTALL_DIR/plugins
v. Start Eclipse
vi. Re-associate the project with the Perforce workspace as per step 7 above


Anonymous said...

Thank you!!!

A million times, thank you!!!

Aleksandar said...

Great! You helped me a lot! Thank you so much!

Anonymous said...

Much thanks!

Anonymous said...

This was useful. Thank you!

metric152 said...

I just tried installing this in Flex Builder 3 and the URL for the install files doesn't work anymore. This is what it should be instead:

metric152 said...

Looks like this is the new URL to check for downloads:

Anonymous said...

Thanks this blog helped me configuring.

sankalp Jhingran said...

I am able to get the plugin from this link:

Hope it helps someone!

Anonymous said...

Thanks for the blog,it helped to automate the things for eclipse CDT setup.