+ Start a Discussion

Question about Force.com IDE with Perforce SCM

We're in the process of evaluating the Force.com PaaS.  We've happily used Perforce as our SCM tool for many, many years, and of course Eclipse (and most other tools) offer extremely robust support for Perforce.  While I've found that the Force.com IDE plug-in and the Perforce plug-in can co-exist, it doesn't exactly seem to be a harmonious pairing.  Operations in Perforce are much more explicit than in other SCM systems, in particular SVN.


For example, by default files synced to the client from Perforce are read-only until explicitly opened for edit, and files added to the filesystem are unknown to Perforce until they are explicitly added.  Files can be added or updated via the Force.com IDE plug-in as a result of changes made through the Web system menu, e.g., in-browser editing of VisualForce pages, changes to custom objects and attributes, etc.  These changes are brought to the client by doing a Refresh from Server or Synchronize with Server.  When this happens, if the files are read-only the Force.com IDE complains that it can't overwrite a read-only file.  I would hope/expect that it would instead engage any active Team plug-in to ask the user whether it should be checked out for edit.  Similar with any added files.  Instead I have to go to the top of the tree and explicitly check out everything for edit, mark everything for add, and then revert all unchanged files to see my "real" changelist.  Alternatively I can set my Perforce client spec to be "allwrite", but it still doesn't really know which files have been edited or added, so while I don't get the complaints about read-only files, I still have to edit/add the files explicitly.
Hopefully I'm just missing something in the Force.com IDE plug-in, the Perforce plug-in, or Eclipse in general.  I'm very concerned about the potential for human error with the current process...enough so that we're discussing whether perhaps a stateless SCM system like SVN might be better, at least for the Force.com portion of the product.
Thanks in advance for any advice!  I may send the same thing to Perforce support to see if I can make progress on a solution.



Scott, we are also looking at using Perforce with force.com. If you make any progress on this, can you please post an update.


Thank you.




I've had the exact same experience and concerns with trying to include the P4 eclipse plugin as part of our development process. In addition I found that if you refresh a file from the P4 depot, making it appear as changed to the Force.com IDE, you can inadvertently write the change back to the Salesforce cloud when your environment rebuilds automatically.


This is all as a result of trying to have the source file location in the filesystem at the same path for both local P4 depot files and Force.com IDE.


Would also like to find more 'best practice' details with respect to using P4 with Salesforce development... I know Salesforce themselves use Perforce... so there must be a smooth way to do it. I wish they would publish a guidline document with such details.

Hi Scott,

I'm a little bit late to answer but hope it will helps others ;)
As an old perforce admin in a software company, i hope i could give you some clues or tips on how to use perforce and Salesforce together. 

As you said, files are made read only by peforce. One way to be able to sync correctly with salesforce is to check out for edit all of you project files prior to sync with your salesforce plateform and modify your files. 
Prior to comit you files (and also depending the configuration you've made on your p4 plugin) you can add new files to your changelist by selectioning the root of your salesforce project. 

Once your ready to commit your changes, you can use the "revert unchanged files" menu of perforce to see and commit only new and changed files. (This feature can also been set as an automation on the workspace configuration or as a company rule on the perforce server itself (needs perforce admin priv to create the rule))

After the commit, you will need again to check out all of your project files to be able to sync with salesforce without any read-only files troubles.

Hope this will help


Scott WellsScott Wells
Thanks for the reply.  We've actually been cranking along very comfortably with Force.com and Perforce for about three years now.  Initially we took the approach that you describe above where we check out all project files while working, revert unchanged files before checking in, and check things out again after a submission.  Eventually we found a better deployment model based on our own ant targets (save, save-all, sync, etc.) that facilitates the use of IDEs other than Eclipse (including Force.com IDE with their builder disabled), and that ultimately allowed us to use the IDEs' own better support for automatic SCM operations (open for edit, mark for add, etc.).  Ever since it's been pretty much out of sight, out of mind!