Eclipse keeps track of duplicate project - eclipse

I want to make copy of an existing eclipse project A and customize it and check it in CVS as a second project B. So I manually copied the entire project A directory into another workspace and opened the project in eclipse. Made changes (removed bunch of files), now when I try to check it in CVS, it somehow recognize it as project A and not a new project B. Seems like I copied some file that tracks the root. How can I remove it so I can check in as project B in CVS?
Even if I try to import the projectB in a different workspace in eclipse, I get the message, project already existsand identifies it as projectA.

See if you can unshare the project through the UI. You likely have the original CVS directories that point back to the existing location.

Related

Eclipse projects deleted from workspace after checkout to another directory

I've a code repository in which is commited an eclipse workspace (everything in the workspace directory except pdom files).
This workspace references several projects that are commited in the same repository.
If I checkout this repository to another place and open it with eclipse, the workspace is empty (no project anymore)
I suspect that eclipse stores projects location with a full path while I expected a relative path.
Unfortunately, I was unable to find in which file of the workspace are stored the projects reference.
I'm using this system for continuous integration with Jenkis. Each branch is checked out in a different directory.
What should I do to make it work ?
Edit : Even if the workspace references projects by their full and not relative path, opening a workspace should at least contain some projects...
OK, I solved it by scripting the building of a new eclipse workspace with the headless feature of eclipse.
No workspace is stored in the repository anymore.

Netbeans & Mercurial - Project Tree Not Updating with Pull

I use Netbeans (7.3), Mercurial, and BitBucket (BB) for personal version control and backup, and also as a way to switch between my work laptop and home desktop. I'm still learning Mercurial, so I created a C++ test project in Netbeans on my desktop and created the BB repository. On my desktop, I init the Mercurial project, commit, and push to my default BB repo, all using Netbeans's GUI commands (no command line Hg commands). My project consists of main.cpp, Person.h, and Person.cpp, where I do some trivial object creation and "cout" to print some strings (print name of Person, "Dave").
On my laptop, I clone the repo from BB to a local directory and open the project in Netbeans. I get the three files as part of my Netbeans project. Now I create a new object, Computer.h and Computer.cpp, and I commit/push to BB... five .h/.cpp files all total in my Netbeans project now.
Back to the desktop: inside Netbeans, I "Pull from Default" and then "Update". When I do this, I can see (Windows explorer) that the new Computer.h/.cpp files were pulled down into the directory, and my main file now shows the changes using the Computer object (print name of Person, "Dave", and name of Computer, "Hal"). The problem is, even though my main file is up-to-date and my project compiles and behaves like it should with the new code, my Netbeans project tree does not show the new Computer.h/.cpp files. I have to "Add Existing Files..." manually to get the new files into the project tree. It's fine when I only add one or two files at a time, but I have a bigger project with a lot more source files, and I can't keep up with how the project tree changes. How can I get the Netbeans project tree to update and reflect the actual file changes that have taken place (additions and deletions to project)? Thanks in advance!
Ensure that your netbeans is configured to store the project file membership under the source directory for your project, (probably in a nbprojects sub-directory), and add some or all of the files in that to your project, (I would look for the file that lists the project members only).
N.B. you will either have to ensure that netbeans is using relative paths or that you have the same paths on both machines, (preferably the former).

Eclipse Egit will not import repo in workspace

I am trying to import an existing git repository as an eclipse project. The repository is stored in the location ~/src/repo_dir, and ~/src/ is my eclipse workspace directory.
If I use the sequence of menu operations:
File --> Import --> Git --> Projects from Git --> Local --> (Select my repo)
--> "Import as General Project"
I get the error:
/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'
and I can't import the project. It seems to be because Egit does not want the original repo that is being imported to already be in the workspace. However, if I then move the repo_dir out of the workspace directory ~/src/, and then import the project via the method above, it doesn't copy the contents to the workspace directory, so now my files live somewhere else, which is undesirable. The only workaround that I have found is to move the repo out of ~/src, import it, delete the resulting project, move the repo back into ~/src, and then import it with git as an 'Existing project.' Does anyone know of a cleaner way to handle this?
There are two different issues here:
Git handles a selected folder in your computer as a repository - and also stores some git-related metadata in it.
Eclipse handles a selected folder in your computer as your workspace. It stores that Eclipse configuration files (not meant to be shared), and even worse, it expects a single-level folder hierarchy for projects.
This means, putting a Git repository inside the workspace might cause a lot of unwanted issues - so I do not recommend this way (even if by some hack it is workable). However, if you want to organize all stuff related to an Eclipse workspace, you could create a folder structure as this:
eclipse-stuff
workspace
git
git-repo1
git-repo2
The workspace folder is given to Eclipse as the workspace folder, while git-repo1 and git-repo2 are your Git repositories.
On the other hand, I like to put all my git repositories into a common folder, regardless of the Eclipse workspace I use them in, but if you want to organize contents, this might not be enough for you.
Had this problem with Eclipse Kepler.
End up with installing Eclipse Mars and import the new project in another workspace.(Luna will also work fine)
If you need to work on current projects and set up environment for the coming one...

How to move Egit repository and working directory

I am new to Egit and created a new repository for a GWT project I'm working on. Unfortunately, I let it create the repository under my Dropbox folder, and now I'm regretting it because I'm syncing megabytes of temp files (e.g. *.class) over the internet. The "create repository" wizard also moved the project's files from the Eclipse workspace to a working directory under Dropbox (along with the .git folder).
What is an easy way for me to move this Egit repository and working directory to somewhere else, other than the Dropbox folder?
(btw, since I'm using Egit, the solution needs to work such that Eclipse is happy and I can keep building/using my project).
I managed to do it myself, here's how:
In Eclipse, right-click MyApp project, Refactor->Move. Move the Eclipse project to a new spot on disk. Note that I kept the .../GitRepositories/MyApp/MyApp dir structure, it's just that I moved the location of GitRepositories to a new place. Also note that this left the old dir with nothing but the .git folder inside it (i.e. Eclipse moved the working files/dirs but not the repo).
Close Eclipse
Move the .git directory from the old directory to the new. Be sure to keep it in the right relative place! I accidentally moved .git from .../GitRepositories/MyApp to .../GitRepositories/MyApp/MyApp. This screwed things up and I had to back track...
Start Eclipse
It might already work at this point, but because I moved .git to the wrong place when I first did it, I had to do the following steps:
Right-click MyApp project, Team->Disconnect
Right-click MyApp project, Team->Share Project...
The wizard automatically finds the Git report relative to the project dir: ../.git
Happy hacking...
When working with a local repository, you can just do the following:
Close Eclipse
Move the git repository on disk
Reopen Eclipse
Select File->Import... -> Git -> Projects from Git
Select local repository and add the new repository location
Select your project(s) to be added
(Optional) Remove the old project references from your workspace.
It may seem like a lot of steps, but it's actually very simple and less invasive than moving the repo and working copy separately.

Eclipse deleting project but not the source code

Is there a way to delete an Eclipse project while preserving all the resources? (i.e. source code, etc.).
I guess I could delete the following files from the project directory manually:
.cproject
.project
But I am concerned that my Eclipse .metadata information that lives in my workspace may still look for those files and get confused if I delete the project files manually.
What I usually do is remove the project using eclipse (do not delete project contents on disk) and remove any .* eclipse-related file that could stay.
With the checkout unchecked, it deletes the project informations while preserving the source code.