Eclipse: Error ".. overlaps the location of another project.." when trying to create new project

JavaEclipseWorkspace

Java Problem Overview


I keep getting an error message in Eclipse when creating a new project.

I have created a workspace at the level

> C:\Users\Martin\Java\Counter

Inside Counter there are no files but there is a directory called counter_src which contains source files for the project Counter

So in Eclipse I do, New Java Project, and then uncheck default location and choose the directory

counter_src (which is one level down from Counter)

but it now displays

> C:\Users\Martin\Java\Counter\counter_src overlaps the location of > another project: 'counter_src'

Now if I create my workspace at

> C:\Users\Martin\Java\

which means my counter_src is actually 2 levels down then it allows me, but the problem is that the directory Java contains lots of projects so I wanted to create the workspace in Counter (which has no files) which has subdirectory of counter_src where my source files are.

Also tested creating directory in C:\Users\Martin\Java\ and it appears to work also but I didn't want to create another subdirectory in "C:\Users\Martin\Java" just to store my workspace for 1 project.

Java Solutions


Solution 1 - Java

Eclipse is erroring because if you try and create a project on a directory that exists, Eclipse doesn't know if it's an actual project or not - so it errors, saving you from losing work!

So you have two solutions:

  1. Move the folder counter_src somewhere else, then create the project (which will create the directory), then import the source files back into the newly created counter_src.

  2. Right-click on the project explorer and import an existing project, select C:\Users\Martin\Java\Counter\ as your root directory. If Eclipse sees a project, you will be able to import it.

Solution 2 - Java

So, I was having the same issue, but trying to import Android code via the "Import..." menu. When neither of the above two solutions worked on Eclipse Juno:

  • Eclipse -> File -> Import -> General -> Existing Project Into Workspace (NOTE: NOT 'EXISTING ANDROID PROJECT')

  • (Projects should import correctly, but should have errors. We must now attach the SDK to the project)

  • Right-Click on the project, Properties->Android->Project Build Target Choose the appropriate build target (in doubt, use 4.0.3 in the project is newish, and use 2.2 if the project is oldish)

  • Click OK

Once the project rebuilds, everything should be back in order.

(This was written when Eclipse Indigo was in vogue, and there may be changes as Google updates their tools to cover corner cases.)

Solution 3 - Java

Your have dropped the Project in your workspace, and then trying to import it, that's the problem.

This has two solutions:

1. More your project folder outside your workspace in some other location and then try.

2. Go to File ---> new Project ---> Select the existing project radio button ---> browse to the project folder in your workspace ---> finish

Edited

Assume D:\MyDirectory\MyWorkSpace - Path of your WorkSpace

Drop your project which you want to import in Eclipse in MyDirectory folder Not in MyWorkSpace, and try.

Solution 4 - Java

In my case checking the check-box

> "Copy project into workspace"

did the trick.

Solution 5 - Java

simply "CUT" project folder and move it out of workspace directory and do the following

file=>import=>(select new directory)=> mark (copy to my workspace) checkbox 

and you done !

Solution 6 - Java

This too took me sometime to figure out.

Solution:

To create a new Maven Project under the existing workspace, just have the "Use default Workspace location" ticked (Ignore what is in the grayed out location text input).

The name of the project will be determined by you Artifact Id in step 2 of the creation wizard.

Reasoning:

It was so confusing because in my case, because when I selected to create a new Maven Project: the default workspace loaction is ticked and directly proceeding it is the grayed out "Location" text input had the workspace location + the existing project I was looking at before choose to create a new Maven Project. (ie: Location = '[workspace path]/last looked at project')

So I unticked the default workspace location box and entered in '[workspace path]/new project', which didn't work because eclipse expects the [workspace path] to be different compared to the default path. (Otherwise we would of selected the default workspace check box).

Solution 7 - Java

In my case clicking the checkbox for 'import project into workspace' fixed the error, even though the project was already in the workspace folder and didn't actually get moved their by eclipse.

Solution 8 - Java

FWIW:

Neither of the other suggestions worked for me. I had previously created a project with the same name which I then deleted. I recreated the base source-files (using PhoneGap) - which doesn't create the "eclipse"-project. I then tried to create an Android project using existing source files, but it failed with the same error message as the original question implies.

The solution for me was to move the source-folder and files out of the workspace, and use the same option, but this time check the option for copying the files into the workspace in the wizard.

Solution 9 - Java

I know this is older, but wanted to contribute another possibly solution.

If you want to keep the project location, as I did, I found that copying the .project file from another project into the project's directory, then editing the .project file to name it properly, then choosing the Import Existing Projects into Workspace option worked for me.

In Windows, I used a file monitor to see what Eclipse was doing, and it was simply erroring out for some unknown reason when trying to create the .project file. So, I did that manually and it worked for me.

Solution 10 - Java

Go to the actual FILE menu and create a new general project.

If the project type isn't recognized, preventing one of these import methods from working, then try this. Once you add the generic project, you can then add support for whatever language you require.

Solution 11 - Java

I got this error when trying to create a new Eclipse project inside a newly cloned Git repo folder.

This worked for me:

  1. clone the Git repo (in my case it was to a subfolder of the Eclipse default workspace)

  2. create the new Eclipse project in the default workspace (one level above the cloned Git repo folder)

  3. export the new Eclipse project from the default workspace to the cloned repo directory:

    a) right click on project --> Export --> General --> File System b) select the new Eclipse project c) set the destination directory to export to (as the Git repo folder)

  4. remove the Eclipse project form the workspace (because it's still the one that uses the default workspace)

    right click on project and select "Delete"

  5. open the exported Eclipse project from inside the Git repo directory

    a) File --> Open Project from File System or Archive b) set the "Import source" folder as the Git repo folder c) check the project to import (that you just exported there)

Solution 12 - Java

this may not solve OP's question, but its relavent

Given::

Lets say you have an existing project in Eclipse,

call ProjectA, in path G:\wsp\eclipse\ProjectA

Problem::

You want to rename the folder name G:\wsp\eclipse\ProjectA of the project to be G:\wsp\eclipse\FolderB;

while keeping the project name ProjectA as it was.

  • if you directly modify the folder name && delete & re-import that project back into Eclipse;

    then you probably get some buggy behavior (-- you cant find the project / import that project properly).

  • if you press alt shift v -- move (refactor) the project;

    then you get the error overlaps the location of another project.

Solution::

  1. F2 > rename the project to be FolderB

  2. alt shift v > move (refactor) the project to path G:\wsp\eclipse\FolderB

    • [here, the error of overlap will not present if you have those 2 names to be the same]

      (and now, you successfully renamed the folder name.)

  3. F2 > rename the project back to be ProjectA

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMartinView Question on Stackoverflow
Solution 1 - JavajustderbView Answer on Stackoverflow
Solution 2 - JavaEagleView Answer on Stackoverflow
Solution 3 - JavaKumar Vivek MitraView Answer on Stackoverflow
Solution 4 - JavaAnuj MehtaView Answer on Stackoverflow
Solution 5 - JavaM_AWADIView Answer on Stackoverflow
Solution 6 - JavaJackDevView Answer on Stackoverflow
Solution 7 - JavadeepwinterView Answer on Stackoverflow
Solution 8 - JavaSpiralisView Answer on Stackoverflow
Solution 9 - JavajlcflyView Answer on Stackoverflow
Solution 10 - JavaErick RobertsonView Answer on Stackoverflow
Solution 11 - JavagomishaView Answer on Stackoverflow
Solution 12 - JavaNor.ZView Answer on Stackoverflow