[p4] Trying to use Perforce via Eclipse

Jeff Jensen jeffjensen at upstairstechnology.com
Wed Oct 12 06:17:51 PDT 2005


Some tips that may help you understand some things, and should at least
clear up problem #2:

- An Eclipse workspace is exactly that .metadata set of files, which are
internal Eclipse config files about your projects in that workspace; it is
not data to source control with the product as some of it is very user
specific.

- So point your Eclipse workspace at some out-of-the-way location, even as
bluntly as "c:\eclipseworkspaces\projectname1"

- The Perforce workspace contains the real assets - the source files.

- To import an existing project into Eclipse, it must already be a proper
Eclipse project, and that means the directory selected for import must
contain a .project file.


Start Eclipse with its workspace (the internal config info) not pointing
into the Perforce workspace (the source files).  In my experience, it works
best when the source workspace and the Eclipse workspace are treated as the
separate beasts they are.


-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of Janine Sisk
Sent: Tuesday, October 11, 2005 11:33 PM
To: perforce-user at perforce.com
Subject: [p4] Trying to use Perforce via Eclipse

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:

${env.TOMCAT_HOME}/
build.log
build.xml
common-init.xml
common.properties
common.xml
project.properties
projects/
version.properties

(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?

thanks,

janine

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. :)
_______________________________________________
perforce-user mailing list  -  perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user




More information about the perforce-user mailing list