Importing projects with Eclipse so new stuff I add will go to the source directory as well
When I do File -> Import, General (from the pop-up window)->Existing Projects into Workspace, I can browse to where all my projects are and import them so my Eclipse workspace folder with its .metadata is in a separate location from my source directory.
The problem is, if I add a new project or even add a new file within an existent project, the new files get made in my Eclipse workspace folder, not over where the other code lives.
How do I tell Eclipse to put new code in the source directory, not in the workspace directory? When importing, I did not check the checkboxes "Copy projects into workspace" or "Add project to working sets" (Add project to working sets requires the selection of working sets, which 开发者_StackOverflowI don't know about).
It depends on the kind of project you are creating. For example, a "Project" type project that just contains dumb files lets you uncheck the "Use default location" option and will actually be created in whatever directory you give it.
Java projects, on the other hand force you to create them in the workspace.
For project types that eclipse will only create in the workspace you can use the following workaround.
- Create the project in your workspace.
- Delete the project from eclipse without deleting the files on disk.
- Use your OS tools to move the project folder where you want it.
- Back in eclipse: File -> Import -> Existing Projects into Workspace
- Browse to folder containing your relocated project.
- Make sure to uncheck the "Copy projects into workspace" option
精彩评论