Prevent perforce from demanding eclipse project files be checked out - eclipse

I'm currently working on several eclipse projects, using Perforce as my source control. I have the perforce eclipse plugin installed.
My problem is that eclipse likes to, for no particularly good reason, write to my .project or .classpath files. It also loves to change the order in which things appear. As such, it demands that I have these files checked out almost all the time. I've somewhat worked around this by creating a pending changelist called "Files which I've checked out for convenience" and stuffing all of the metadata objects that eclipse asks about there.
This has the downside that if anyone updates some metadata (for example, adding a new project reference or changing the classpaths) I now have to resolve differences before they'll show up, adding extra time and trouble to my project.
Coming from Subversion, this is a really rude surprise. With SVN I could just wait until I checked in and move these files to the ignore-on-commit changelist, as needed. SVN would also merge new updates into these files without bugging me.
Basically, is there any way to prevent eclipse from constantly futzing with my projects, or am I just stuck here?

I'm assuming the .classpath and .project files are in version control, since that what causes them to be read only. There is an option in Perforce using P4V to make just those files always writable. Right click the files and select 'Change Filetype...' and select the +w Always writable in workspace option. This will affect all clients using that branch / stream, but now changes can be made without marking for edit first.
If you would like that to be the default for all of your depots, then you can have a Perforce admin to change the p4 typemap so that any new .classpath and .project files will be writable.
See http://www.perforce.com/perforce/r12.1/manuals/cmdref/o.ftypes.html

Have you tried adding a .p4ignore file to the project root dir, containing
.classpath
.project
Support docs for P4IGNORE

Related

Eclipse ignored resource are still showing as changed, how do I stop this behavior?

I have a Java project that is committed to an SVN repository. I'm using the Subclipse plugin in Eclipse Luna. The .project file was initially committed, but we don't want to commit any updates to the .project file that eclipse makes. I've added a .project entry in the ignored resources, but the .project file still shows up as a change, for example, when I rename the project folder, or do anything else that might cause Eclipse to change that file. I see the out of synch star for the top-level folder (of course the .project file is not shown in the project explorer), but the .project file does appear in the synchronization window and the commit dialog. What is the issue here? How can I get Eclipse to actually ignore changes to this file?
SVN, like most version control systems, won't let you ignore files that are already in the repository. To quote the book (emphasis added):
Subversion's support for ignorable file patterns extends only to the
one-time process of adding unversioned files and directories to
version control. Once an object is under Subversion's control, the
ignore pattern mechanisms no longer apply to it. In other words, don't
expect Subversion to avoid committing changes you've made to a
versioned file simply because that file's name matches an ignore
pattern—Subversion always notices all of its versioned objects.

Creating eclipse project from old project

I have an old eclipse java project which is stored in SVN. I wish to create a new one based on the old one but without the SVN files. I'll be doing some experimental changes to it and I want to have the old one as backup basically. Anyone can give advice on how to do this? Thanks
FYI: This has been posted in Javaranch as well
You have a number of options:
Don't do a check-out (which creates the metadata files, allowing for changes to be easily and later committed), but an export instead. From the "SVN Repositories" view in Eclipse, right-click the project folder, then click "Export...".
Just check-out a 2nd copy of the project from SVN, naming it with a different project name in the workspace to keep it distinct. Just refrain from checking-in any changes back to the SVN repository.
Copy the project as usual, and simply delete the SVN metadata files.
Same as #3, but let Eclipse do this for you - using Team / Disconnect.

Can't commit at all with Subversive Eclipse; may have foobared whole project

I am having terrible trouble with SVN in Eclipse Indigo with my Java project.
I am not a hobby, not a professional programmer, but I have heard how important version control systems are for serious projects, and thought it was time I learned how to use one.
Now I find I can't commit, no matter what I try. I get different errors depending upon what I do.
I suspect the problem was caused by my checking the "Persist project refactoring history in project folder instead of workspace" box in Project > Properties > Refactoring History, but I am not sure. But since I did that, I got an error saying "svn: Path '.settings' not present" error. I tried again,unchecking the box for .settings/org.eclipse.ltk.core.refactoring.prefs. This time I got a different error upon an attempted commit, "Path 'gamecore' not present". ('gamecore' is a root-level package in the project, where I'm putting most classes until they can be moved somewhere more appropriate.)
I tried several permutations of fiddling with the project preferences I'd changed, and unchecking some files on attempted commits. All failed.
In desperation, I cut n' pasted the source files I'd changed to a text file, reverted to my previous version, then cut n' pasted the new versions over top of the old. This time I got "svn: File '/Space Game/.refactorings' is out of date".
So I am in a position where, no matter what i do, I can't commit. At this point I am considering expunging the whole repository and importing from my workspace (something I did when I accidentally deleted the project before, thinking there was a duplicate in the repository.)
I've searched the web for the errors I've had, and all the threads I have found seem to assume a lot more knowledge of version control than I have. Most include bash shell commands, which I don't have access to.
My questions are:
1) Is this the best course of action?
2) Is there another less drastic way to recover?
3) How to I prevent this error from recurring?
I am using Eclipse Indigo with Subversive SVN Connectors 2.2.2, Subversive SVN Team Provider 0.7.9 and SVNKit 1.3.5 Implementation 2.2.2.
This happenend beacuse you checked your eclipse metadata into source control and then moved it by changing those settings.
So first do an update to get the meta files back. If you watch the svn console youl see something like: Restoring FILENAME
After you have them back and assuming your project is still set to put the meta data in a separate folder then you can do an svn delete on them and commit the deletions.
Set up an svn:ignore on all eclipse metadata ie:
.project
.settings
.buildpath
.refactorings
If i were you i would close eclipse and do this all from the command line so it doesnt confused.:
cd /path/to/project/root
svn up
svn rm .project .settings .buildpath .refactorings
svn commit .project .settings .buildpath .refactorings -m "Deleting eclipse metadata."
svn propedit svn:ignore .
# this will open an editor ignored files are one per line so your file should look like
# the following without the "#" signs
#
# .project
# .settings
# .buildpath
# .refactorings
svn commit . -m "Adding ignores to eclipse metadata files."

Get eclipse CVS to forget about removed directory

I'm looking for a way to convince Eclipse that a directory has indeed been removed from the CVS repository, permanently?
With regular command line CVS I would just edit CVS/Entries in the directory's former parent. With Eclipse, I've tried removing the directory from the Project Explorer view, removing the appropriate line in CVS/Entries, recreating the directory in PE so that it might be removed on update or synchronization, synchronize without recreating the directory, and probably other things that I've since forgotten, and nothing worked.
The directory has been entirely removed from the CVS repository, so I'm not talking about just pruning empty directories here. The error I am seeing is:
The server reported an error while performing the "cvs update" command.
Project: cvs update: cannot open directory /usr/local/cvsroot/one/two/three/removed_directory: No such file or directory
My project contains all of the contents from /usr/local/cvsroot/one/two. I do not get this error when I navigate to "three" and update from there. I only get it when I update from the project root.
One (quite imperfect) solution for this problem is, beside to check-out the project again, to remove CVS information stored by Eclipse.
Go in the right-menu under the project > Team > Disconnect, and check the radiobutton "Also delete the CVS meta information from the file system". Now your project is unshared and has no more CVS information into it. Then you just have to do Team > Share project, select the previous repository location, and you're done (CVS will detect by itself that the project is up-to-date and won't update nor commit anything, of course).
A folder that has been deleted in the cvs repository by hand won't then be proposed anymore by CVS under Eclipse to be commited.
Beware that on a big project with many files, depending on the speed of your network, the re-share may take some time.
Sometimes it may indeed be easier to delete the project and pull it off again from CVS.
I fought this same thing for several hours a couple of separate times. I just gave in and re-checked out the project. That seemed to work like a charm
Handling of directories in CVS is not perfect. This and many other reasons caused in creating more complete SCM tool subversion.
CVS can create directory, but can not remove it. From CVS point of view, to remove directory you need to remove (cvs rm) all files in directory. But directory is still present in CVS and there's no way to remove it. Hovewer, CVS propose a "hack" to hide such "deleted"/empty directories by executing "cvs up -P" (see here).
So, for CVS command line, I wouldn't mess with parent directory CVS/Entries file, but rather use "cvs up -P" described above.
The directory will be listed in the CVS/Entries file under the parent directory. Remove the entry in the Entres file and the directory. Eclipse should recognize the directory has been removed.
Refactoring directories in CVS is problematic. Due to the way CVS handles history one of the following usually applies:
The history of files moved to new locations appears to disappear. (It is located in the history of the old location.)
The history of files is retained, but files appear moved when checking out versions prior to the move. (Files were moved in the repository, rather than in a sandbox.)
Removing or moving directories in the repository generally creates problems for clients. It helps to retain directories and only move or remove files. Normal processing moves deleted files to an Attic sub-directory.
In the Eclipse CVS synchronization perspective, did you try the 'Override and update' option?
If the files/folders are already deleted on the repository, from the Eclipse project perspective, "replace with"->"latest from HEAD" on the folder containing deleted elements

What Eclipse metadata files should be in the repository?

I'm working on a new project with a full ANT build. I use eclipse to write my code, and I would like others to be able to check out the project to have a full working eclipse workspace. I do not want to have specific user settings committed though.
What files and directories should I have in source control?
(I'd rather not just go grab a plugin - I prefer more control over what goes in the repository)
We just put .project and .classpath in our repository, and that's sufficient to make it work "out of the box" for new developers. I'd like to have other stuff (run configurations come to mind), but haven't figured out how.
We use Subversion, so I put these files in a separate directory and defined svn:externals on that directory to point to the actual code, leaving it unpolluted by IDE-specific files.
Per request in the comments, here are the external that we use. Nothing complicated going on here:
Properties on 'svn://dev/trunk/IDEs/eclipse/runtime':
svn:ignore
bin
.fbprefs
cobertura.ser
.settings
svn:externals
lib/bin svn://dev/trunk/lib/bin
runtime svn://dev/trunk/runtime