Opening existing project from source control

2020-05-29 19:54发布

I've been pushing my source to a Mercurial repository. Today I needed to delete my local copy and re-clone. I did this by simply moving my local copy somewhere else (just in case) and typing "hg clone url".

This part has worked just fine.

However, when I try to pull the newly cloned local copy into Eclipse, I get the following error:

/Users/Andrew/Dev/Workspace/Android/MyProject overlaps the location of another project: 'MyProject'

My guess is that I have been committing some meta file or something that I shouldn't have. Does anyone have any ideas? Here is my .hgignore:

syntax: regexp
\.DS_Store
.swo
.swp
.metadata/
/bin/

Note: Looks like my hgignore is not blocking the gen folder. Could this be part of the problem?

5条回答
Explosion°爆炸
2楼-- · 2020-05-29 20:26

There is a bug in Eclipse what won't let you create an Android project from existing sources:

http://code.google.com/p/android/issues/detail?id=8431

You have to move MyProject to a folder that doesn't have any other projects in its sub-directories. You can then make a new project from existing source with MyProject. Remove the new project from the workspace without deleting the contents on disk and move it back to your Android folder. Now do an Import -> General -> Existing Project into Workspace, and MyProject should be available to import.

This is the only way I've been able to do it.

查看更多
萌系小妹纸
3楼-- · 2020-05-29 20:27

Ok, I'll try to sum it up, after I faced similar problems and wasted some time:

Eclipse Juno /4.2 SR1 (however I think it is a general misunderstanding of how eclipse imports projects)

  1. If you want your new project "connected" to git/mercurial, you'll have to clone and import via "Import/Git/Import from Git"
  2. It will fail if your "workspace dir" equals the "local destination dir". A git clone via egit MUST NOT be placed! in the "eclipse workspace dir"!

The project import will fail because the projectname in the cloned ".project file" already exists in the eclipse workspace dir when the import occurs.

查看更多
对你真心纯属浪费
4楼-- · 2020-05-29 20:31

I think the problem is that you moved your local copy away and then you try to add another project into Eclipse at the same location as what you had before and you are just confusing Eclipse...

I would recommend to try to use command line commands for Mercurial and when you get into Eclipse, first clean up existing projects before adding another one.

查看更多
▲ chillily
5楼-- · 2020-05-29 20:38

My sollution was just to import as general project not an android one.

查看更多
Anthone
6楼-- · 2020-05-29 20:46

I ran into this problem when trying to import a git repo project and it's submodules. I ended up using import -> git -> Projects from Git (git plugin). This understood the concept of a project within a project just fine. The project is now monitored by that plugin. It's a good enough tradeoff for me.

查看更多
登录 后发表回答