159

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
Lii
  • 11,553
  • 8
  • 64
  • 88
Frankie
  • 24,627
  • 10
  • 79
  • 121
  • 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. – PointedEars Aug 11 '15 at 12:06

9 Answers9

263

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.

djb
  • 4,930
  • 1
  • 34
  • 37
  • 14
    +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. – sstn Sep 06 '11 at 08:07
  • 2
    File.. Move opens the same dialog. [Eclipse: Indigo Service Release 1] – amit Feb 14 '12 at 00:59
  • 19
    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\MyProject` – Basic May 14 '12 at 09:27
  • 1
    @amit - 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)... – Paul Molodowitch Oct 09 '12 at 17:36
  • 1
    And what if you don't have the Java perspective installed, so there's no package explorer view? *grumble grumble* – Jameson Quinn Apr 25 '13 at 17:32
  • 8
    To answer my grumble above: this is also available from the Navigator (Window > Show View > Other..). – Jameson Quinn Apr 25 '13 at 17:43
  • 2
    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? – TrueY Sep 18 '14 at 10:07
  • 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. – stu Jun 19 '15 at 20:17
  • @stu 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.) – djb Jun 20 '15 at 16:45
  • 1
    hmm... my cdt (Version: Luna Service Release 2 (4.4.2)) doesn't seem to have the java perspective, or the view. – stu Jun 22 '15 at 13:27
  • @stu It should have the Navigator view. – PointedEars Aug 11 '15 at 12:00
  • but only the java package explorer has the move project function, I think. – stu Aug 13 '15 at 00:17
  • 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). – faintsignal Mar 17 '16 at 16:42
  • @faintsignal 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. – djb Mar 18 '16 at 17:22
  • @djb does this will not affect the `.git ` directory inside the project folder – Kasun Siyambalapitiya Jan 18 '17 at 09:51
  • 1
    @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) – djb Jan 19 '17 at 16:14
  • 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) – e-motiv Apr 24 '17 at 18:46
  • does anyone know where to find this magic refactor in Version: 2020-03 (4.15.0) Build id: 20200313-1211? – Ray Tayek Sep 11 '20 at 00:39
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

typoerrpr
  • 1,626
  • 21
  • 18
  • Or the more powerful "project explorer" view. – Mickael Aug 17 '16 at 20:00
  • 2
    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 thanks – Ckln Sep 19 '16 at 08:25
  • 1
    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. – davidA Sep 30 '17 at 20:54
  • Awesome! Worked perfectly in Eclipse IDE for C/C++ Developers Version: Oxygen.3a Release (4.7.3a). – Gabriel Staples Mar 05 '19 at 07:22
  • 2
    Does not work for me under Neon, `move` in *navigator* and *explorer* is the same – lalebarde Jun 03 '19 at 14:22
  • Navigator appears to be deprecated now – Evgen Aug 24 '23 at 19:46
  • 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. – Evgen Aug 24 '23 at 19:50
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

  • Does this alto import all the project-specific Eclipse settings that existed in the original project? – davidA Sep 30 '17 at 20:52
  • 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! – Evgen Aug 24 '23 at 19:51
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

Rodney Gitzel
  • 2,652
  • 16
  • 23
  • 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!) ;) – Frankie Aug 13 '10 at 18:37
  • even though this really isn't what I was looking for guess your answer is perfectly valid so I'm going to accept. Thks! – Frankie Aug 26 '10 at 19:23
  • 1
    @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 option – Kyle Hayes Dec 15 '11 at 19:28
  • It works and in some cases it may be the only working solution (=>: +1), but it is far from optimal. – peterh Apr 25 '16 at 09:05
  • 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. – Evgen Aug 31 '23 at 22:49
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!

3

Right click on your project->copy.

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

chose new folder and project name.

mohammadsdtmnd
  • 330
  • 1
  • 11
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).

chris
  • 21
  • 2
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.

Community
  • 1
  • 1
Tamias
  • 173
  • 9
0

For Eclipse Oxygen

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

user207064
  • 665
  • 5
  • 14