Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should renaming a project in Eclipse also rename project folder on file system?

Should renaming a project in Eclipse also rename project folder on file system ?

My project file system name remains the same even when I rename the file on Eclipse.

Should I manually rename the project on the file system to same on Eclipse ?

like image 824
blue-sky Avatar asked Feb 10 '12 16:02

blue-sky


People also ask

Can you rename an Eclipse project?

In the Eclipse Navigator view (or any Eclipse view that supports Team operations), navigate to the project that you want to rename. Right-click the project and click Team > Rename in Repository Workspace.

How do I rename a Java project folder?

Right-mouse click in the repository view on the folder you want to rename and choose Rename path process. Rename the folder.

How do you change the name of a project folder?

Summary StepsGo through all unavailable projects and click “F4” key view project properties. Set the file path to the new folder location. Right-click > Reload project. Change the display name of the project.

How do I rename something in Eclipse?

Right-click the item you want to rename in the editor, and click Refactor > Rename. Alternatively, click Refactor > Rename from the main menu or right-click the identifier in the Outline or the Program Outline views and click Refactor > Rename.


2 Answers

It appears that renaming a project will only rename the underlying filesystem directory if the project was created with the "Use Default Location" checkbox selected (meaning the project is created in the workspace directory). If you create a project and specify a custom location outside the workspace, renaming that project in Eclipse does not rename the project's host directory. In that case, you'll probably want to:

  1. Rename the project in Eclipse (which will update any internal references and the .project file)
  2. Remove the project from your Eclipse Workbench view (making sure that the "Delete file contents" option is NOT selected in the delete confirmation dialog).
  3. Rename the project's directory in your filesystem.
  4. Import the project back into your Eclipse workspace.

I was surprised to learn this (I tested it with Eclipse 3.7), but it seems to be logical to me. The idea is that projects in the workspace folder are considered to be "under Eclipse control" as opposed to projects that are located in arbitrary places on your filesystem.

like image 122
E-Riz Avatar answered Oct 03 '22 11:10

E-Riz


Use Refactor to rename the project name. It will rename the file/folder in filesystem as well.

Refactoring in Eclipse

like image 25
Jayy Avatar answered Oct 03 '22 11:10

Jayy