[p4] Trying to use Perforce via Eclipse

Janine Sisk janine at furfly.net
Tue Oct 11 21:32:53 PDT 2005

Hi all,

I'm new here.  I'm not new to programming, but I'm new to the Java  
world and all the tools that go along with it.  In this case, Eclipse  
and the Perforce plugin P4WSAD.  I'm having a couple of problems,  
which are undoubtedly the result of newbie error but I've exhausted  
all options I can think of to fix them, so here I am.

Problem #1:

I have a source tree in Perforce I'm attempting to work with that  
looks like this:


(the trailing slash is my way of noting that these are directories)

If I point Eclipse at a directory containing the above and tell it to  
File->Import->Existing Project into Workspace, everything goes just  
fine;  I end up with a complete project I can build successfully.   
What I see in the Package Explorer is just the directories under  
projects.  But trying to do the import from Perforce is another story.

When I go into the Perforce view in Eclipse, I can browse the Depot  
and see everything.  But the only time the right-click menu contains  
Import as Project is when I have one or more directories selected.   
If I have any files selected, it goes away.  So the only places I can  
import from are at the depot level, the projects directory level, or  
the projects themselves.  I can't get the rest of the files in the  
listing above unless I import from the depot level.

If I do the import from the depot level I end up with the entire  
directory structure in the Package Explorer, including the depot  
folder, and Eclipse doesn't seem to recognize it as a proper  
project.  The Clean and Build menu options are greyed out.  If I do  
the import from within the projects folder, importing all the  
projects, the result looks like what I expect except that none of the  
project pieces know about each other;  they all complain that the  
others are missing.

What do I need to do to make this work?

Problem #2:

I have created a client workspace in Perforce, which uses (for  
example's sake) the directory p4ws as it's root.  If I tell Eclipse  
to use the same directory for it's workspace and do any of the  
"import as project" imports described above, "p4 sync" is executed  
and the files are copied from the server if they are not already  
there, but Eclipse does not do it's usual "building workspace" step.   
So when I switch over to the Java view, there is nothing there.  The  
workspace is only built correctly if I use a different directory for  
Eclipse's workspace, which ends up containing only a .metadata  
directory.  This seems wrong, using different directories, but again  
I can't seem to figure out how to get around it.

Obviously I have a lot to learn here. I have attempted to RTFM, and I  
have spent hours trying various combinations of this and that trying  
to figure out how to make this work, but I'm stuck.  Can someone  
please enlighten me?



PS this entire project is a learning exercise - the above source tree  
is from an open source project I might want to use on one of my  
projects, and I loaded it into my Perforce instance to work with and  
learn from, and to decide if I want to use Perforce or Subversion.   
So don't stress over the fact that I have committed the old build  
log. :)

More information about the perforce-user mailing list