如何为添加到Eclipse工作空间的项目使用相对路径? [英] How to use relative paths for projects added to an Eclipse workspace?

查看:735
本文介绍了如何为添加到Eclipse工作空间的项目使用相对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理存储在USB密钥上的一些Eclipse项目。我已经将它们添加到根文件夹也在USB密钥上的工作空间,但项目不是直接位于该目录中。因此,它们的绝对路径写在工作区的.projects文件夹中。

I am working on some Eclipse projects that are stored on a USB key. I have added them to a workspace whose root folder is also on the USB key, but the projects are not located directly into this directory. As a result their absolute paths are written in the .projects folder of the workspace.

当我在几台计算机上使用密钥时,会引发问题,因为分配给USB密钥并不总是相同的(我不想在所有计算机上分配一个特定的字母)。当我将项目添加到工作区时,当驱动器号与USB密钥不同时,Eclipse无法打开我的项目。

This raises problems when I use the key on several computers, because the drive letter assigned to the USB key is not always the same (and I do not want to assign a specific letter to it on all computers). Eclipse cannot open my projects when the drive letter differs from that of the USB key at the time I added the project to the workspace.

有没有解决这个问题?具体来说,有没有办法使Eclipse通过使用工作空间文件夹的相对路径将项目添加到工作区?

Is there a solution to this problem ? Specifically, is there a way to make Eclipse add projects to a workspace by using their relative path from the workspace folder ?

推荐答案

简单的回答是,您不能在没有黑客工作区元数据( [workspace.dir] /。metadata )的情况下执行此操作。 Eclipse工作区不是设计为便携式的,即使您没有物理移动工作区,您也正在通过更改驱动器盘符来移动它。

The short answer is that you cannot do it without hacking your workspace metadata (under [workspace.dir]/.metadata). Eclipse workspaces aren't designed to be portable and even though you are not physically moving your workspace, you are in effect moving it by changing drive letters.

我建议您尝试找到一种方法让您的项目位于 workspace.dir 之下。不保证你不会有这样的问题,但可能会提高你的赔率。根据您使用的Eclipse的哪些功能,您可能会很好地得到工作空间元数据中其他类型的绝对路径。

I'd recommend trying to find a way to have your projects under workspace.dir. Not guaranteed that you will not have problems that way, but may improve your odds. Depending on what features of Eclipse you use, you may very well end up with other types of absolute paths in your workspace metadata.

这篇关于如何为添加到Eclipse工作空间的项目使用相对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆