开发者

Create a project in Eclipse in a subfolder of the workspace

I want to create a Java-project in a subfolder of the workspace-directory. The wizard either lets me create a project in the workspace-directory, or import开发者_高级运维 an existing one. Is there any way to achieve this?


Step 1) Create project X as usual (it will end-up in the root of your workspace)

Step 2) Use a command-line shell of your OS to move the project X directory hierarchy under the desired target directory e.g. mv ~/workspace/abc ~/workspace/target/some_directory/

Step 3) Delete the original project X (do not select 'delete files')

Step 4) Import project X using `File -> Import -> Existing project into workspace'

Project X will appear in the package explorer view as it normally would.

Hope this helps :)


To my knowledge, no: the only "directory" under which you can create a project is the "working set" one.

That special directory is visible by selecting the right top element:

Create a project in Eclipse in a subfolder of the workspace


PS: just to be complete, creating a project within a project (nested project) is also not possible (bug 43536 )


If you are importing projects from SVN, and you want to preserve a parent folder that exists in SVN, you can preserve that project hiearachy in your workspace.

Say your SVN looks like this:

svn://svn.acme.com/svn/trunk/team-a-projects/com.acme.a.stuff/...
svn://svn.acme.com/svn/trunk/team-a-projects/com.acme.a.more-stuff/...
svn://svn.acme.com/svn/trunk/team-b-projects/...

Then you can preserve the "team-a-projects" folder in your workspace. Follow these steps:

  1. Browse your SVN repository in SVN repository exploring perspective and locate the "team-a-projects" folder.
  2. Right click on the folder and choose "Find/Check-out as..."
  3. Select the "Find projects in the children of the selected resource" option and click "Finish"
  4. Wait while Eclipse digs into the folder to find projects (.project files)
  5. On the "Check Out Projects" dialog choose the "Check out as projects into workspace" option. Note the projects it will create are shown in the table.
  6. Check the "Respect projects hierarchy" option. This will preserve the "team-a-projects" folder as a parent of the projects in the workspace.
  7. Click "Finish" (or next if you want to mess with working sets)

Eclipse will then create projects in your workspace. Note that in the UI you will not see your parent folder (e.g. "team-a-projects") but if you right click on a project and look at the resources (or go and look in the filesystem) you will have projects in a subfolder of the workspace.

I have not tested it with multiple levels of folders, only a single level. But I guess it would preserve those too? Good luck.


It is possible to add a subfolder to a project, by right clicking on the project folder, going to new, and clicking on new folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜