Moving project to another folder in Eclipse
Asked Answered
A

9

160

I generally have my working projects sitting on folders on my Desktop. When they are completed I just move them to a c:\dev\. The thing is I'm doing it in a rather archaic way.

1. move project files
2. delete project on Eclipse
3. create new project on Eclipse on the new location

How to you guys move projects around?

If I could alter the: File -> Properties -> Resource -> Location path it would be dead simple!

Example move:

c:\user\desktop\project_123
c:\dev\project_123
Aspen answered 13/8, 2010 at 17:54 Comment(1)
You have your answer, but JFYI: You should not move the project files before you have deleted the project in the Eclipse workspace (i.e., you should do 2., then 1.), unless you close the project first. Otherwise you are likely to get error messages and may end up with a borked workspace.Pattipattie
W
264

Right click on the Eclipse project in the Package Explorer, select Refactor, then select Move... In the dialog that comes up, enter or navigate to the new location and click OK. This will also preserve your CVS or other SCM metadata, but will also bring all your modifications as well, and you won't lose any memberships in Working Sets, launch configurations, or other things that Eclipse associates with your project.

Wallpaper answered 21/10, 2010 at 19:36 Comment(18)
+1 It seems to be one of the eclipse oddities that you need to switch to the Java perspective to open the package explorer to move a C/C++ project... seems to work anyway, at least for a makefile project.Nagel
File.. Move opens the same dialog. [Eclipse: Indigo Service Release 1]Brittle
Just a pointer that it will automatically append the project name to the path specified so eg D:\Source\MyProject should be moved to D:\OtherSource not D:\OtherSource\MyProject - The latter would result in D:\OtherSource\MyProject\MyProjectNanananak
@Brittle - this may have been the case in Indigo, but on eclipse 4.2/Juno, the "File, Move" dialog is NOT the same as the dialog you get from the Java Perspective, with "right-click, Refactor, Move"... the "File, Move" one only allows you to move it inside another project (which doesn't even work)...Deflate
And what if you don't have the Java perspective installed, so there's no package explorer view? grumble grumblePhilipps
To answer my grumble above: this is also available from the Navigator (Window > Show View > Other..).Philipps
I tried to find Package Explorer in Eclipse-cdt (Luna), but I could not find it (Windows > Show View > Other > "explo"). Does anyone knows how can change the project path?Fahey
yeah, there's no package explorer in cdt and there's no refactor in the project explorer, I have a feeling you can't do this with cdt which is too bad, that's an awesome feature.Yanirayank
@Yanirayank Above, others above point out that in CDT you can open the Java perspective and then open package explorer view and then refactor. The Project Explorer in JDT also has Refactor->Move, so if you can access that from CDT, that may work also. (I do not use CDT, so I can't confirm if either of these work.)Wallpaper
hmm... my cdt (Version: Luna Service Release 2 (4.4.2)) doesn't seem to have the java perspective, or the view.Yanirayank
@Yanirayank It should have the Navigator view.Pattipattie
but only the java package explorer has the move project function, I think.Yanirayank
I want to move my project into a subdirectory of the present location, but Eclipse (Mars) prevents this because the new location "overlaps the location of another project" (the other project being that which I am trying to move).Bul
@Bul you can probably move it to a side directory first. i.e. /workspace/a and you want to put it into workspace/a/b -- first move to /workspace/c then create a new empty directory /workpace/a then move from workspace/c to workspace/a/b.Wallpaper
@Wallpaper does this will not affect the .git directory inside the project folderSeldan
@KasunSiyambalapitiya this should move the project and all project subdirectories including .git (The original answer says "This will also preserve your CVS or other SCM metadata", where "SCM" means source code management -- this includes Git)Wallpaper
In javascript view, 'Refactor' can be found under "Script Explorer" and the project has to be open(ed). The equivalent "move" menu item is grayed out when a project is selected. (Kind of bug)Rechabite
does anyone know where to find this magic refactor in Version: 2020-03 (4.15.0) Build id: 20200313-1211?Petasus
O
26

Use Eclipse's Move menu item

Open Navigator view, right click on your project and click Move. Then select the destination directory.

Navigator View > Right Click > Move

Note it doesn't seem to work in Package Explorer (at least not in Neon). The move dialog from Package Explorer is different, so use the Navigator window.

enter image description here

enter image description here

Ophite answered 12/8, 2016 at 1:54 Comment(7)
Or the more powerful "project explorer" view.Centralia
Seems I am unable to do so throught the «project explorer» view but only for some projects. thanks to your answer using the «Navigator» view works perfectly thanksInitiative
This is the right answer for me - thank you. In my case - using Eclipse Oxygen with CDT - only the Navigator view has a usable "Move" option. In the Project Explorer view, the Move option is greyed out if the project is open or closed.Dockage
Awesome! Worked perfectly in Eclipse IDE for C/C++ Developers Version: Oxygen.3a Release (4.7.3a).Jessie
Does not work for me under Neon, move in navigator and explorer is the sameBantustan
Navigator appears to be deprecated nowIrresolvable
Also, when I try to move, I get "Resource already exists on disk" error. I already have a Perforce workspace there, not sure if that's the issue. And I need to have that workspace as it's properly configured for a different version. Eclipse is such an awkward tool - everything is difficult.Irresolvable
P
11

I don't know whether eclipse has made modifs since the date of this post... In my case I had moved a project folder manually and I wanted Eclipse to open the project on this new location. This is what I did (and it seems to work).

  • (I'm using eclipse "helios" v 3.6.2)

  • File menu | Import ...

  • General | Existing projects into Workspace

  • Select root directory = top directory of your project on the new location

  • Finish

Placet answered 3/10, 2012 at 11:53 Comment(2)
Does this alto import all the project-specific Eclipse settings that existed in the original project?Dockage
This requires re-doing all the adjustments for building, surce control set-up, and many other things I don't remember. That's several hours of work!Irresolvable
C
5

I rarely have any projects in Eclipse that aren't under source control, so all I would need to do is check the project out in the new location.

If you don't have source control, Eclipse works with CVS rather well out of the box, and it's pretty simple to setup CVS to run locally without a server: http://www.tortoisecvs.org/faq.html#cvsinit

Collodion answered 13/8, 2010 at 18:0 Comment(5)
thks for your input! All my projects are also on CVS using Mercurial, so I can easily change them across the file-system without hassle. I also understand that maybe the easier way would be to export/import the project using Eclipse's built-in mechanism. Was just looking for an even easier solution (like changing the Location path!) ;)Aspen
even though this really isn't what I was looking for guess your answer is perfectly valid so I'm going to accept. Thks!Aspen
@Frankie, I agree, I would have liked to see an option for Eclipse to rename the actual disk folder the project source is in. I'm not sure why that isn't an optionClarinda
It works and in some cases it may be the only working solution (=>: +1), but it is far from optimal.Grantor
How does it work? I can check out the project at a different location, but there's no Eclipse set-up there, and no option to switch to that workspace.Irresolvable
S
5

Right click on your project->copy.

right click in project explorer free space and right click->pase.

chose new folder and project name.

Salacious answered 30/3, 2020 at 9:30 Comment(1)
One caveat: the project has to be named differently than the source. Not too surprising of course, but at least it works as of 2024 with CDT projects.Hydrosome
B
4

WHEN EVERYTHING ELSE FAILS:

Copying an Eclipse project from one directory (let's call it old_dir) to another directory (let's call it new_dir):

  1. Open Eclipse and specify the copied working directory in your new_dir.

  2. Once it opens the project in the this new_dir, the projects listed under Project Explorer Tab might still be the ones contained in the old_dir (you can check it by right clicking each and following through: "Resource -> Linked Resource" to see the Path Variables values). Thus, they have to be removed from this work space. Delete the Nios 2 Application Project and the BSP Project from the Project Explorer Tab by right clicking on it and selecting Delete option which will pop a new window. In the pop-up window, make sure that the Delete project contents on disk check box is UNCHECKED before clicking OK to delete the Projects. Otherwise, it will delete it from the old_dir where you copied the project from.

  3. Right click in the Project Explorer Tab Area → Import → General → Existing Projects into Workspace and add the copied Nios2 Application Project and the BSP Project from the new_dir.

  4. Right click in the Project Explorer Tab Area → Index → Rebuild, otherwise the Nios2 Application Project will not be able to use the includes provided by the BSP Project.

  5. Click on Project → Clean → OK to clean and rebuild the whole project.

  6. When using console to talk to the NIOS, make sure elf's path is updated to the new project directory as well!

Bourn answered 13/2, 2016 at 12:52 Comment(0)
C
2

I copied the whole project to a new directory. After setting Eclipse to the new workspace it recognises the project instantly. Thus it was nothing further to do. I use Eclipse IDE for C/C++ Developers, Version Luna Service Release 2 (4.4.2).

Cinchonidine answered 29/1, 2016 at 12:19 Comment(0)
F
1

For Eclipse Oxygen, to move a Java project, djb's accepted answer works well (in my experience just now), except having read comment by Basic May 14 '12 at 9:27, I tried to add my project XMLDiff to C:...\SVN\trunk\Internal Projects, and I got a failure with the rather cryptic message:

Problems encountered while moving resources.

Resource already exists on disk.

I had to move the project to C:...\SVN\trunk\Internal Projects\XMLDiff by creating a new folder, XMLDiff, in the browse dialog, and the result was C:...\SVN\trunk\Internal Projects\XMLDiff, not C:...\SVN\trunk\Internal Projects\XMLDiff\XMLDiff.

So this must have changed between Basic's experience in 2012 and Eclipse.3.

Fruin answered 14/6, 2018 at 21:13 Comment(0)
S
0

For Eclipse Oxygen

Project Properties -> Resource -> Linked Resources -> Linked Resources (Tab)

Stationary answered 29/11, 2016 at 10:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.