有没有办法设置相对于 .project 文件的链接资源?

发布于 2024-09-29 08:31:23 字数 403 浏览 0 评论 0原文

我们有一个 Flash Builder(基于 Eclipse)项目,它从不同位置提取源代码,包含在项目所在的源代码管理中。根据我们的组织要求,源代码位于不直接位于项目目录下的目录中。最初,我们遇到的问题是链接资源的所有路径都是绝对的,并且在具有不同路径的其他计算机上不起作用。

现在,我们对此的解决方案是设置一个指向工作文件夹根目录的链接资源路径变量。所有其他位置都基于此,因此我们可以包含来自类似文件夹的源。

${WORKING_BASE}/library1
${WORKING_BASE}/library2

此解决方案的问题是,提取该项目的每个人都必须在打开项目之前正确设置 WORKING_BASE 变量才能使其工作。我的问题是,有没有办法使链接资源相对于 .project 文件的位置?那将是理想的。

We have a Flash Builder (which is based on Eclipse) project that pulls source from different locations, included in the source control in which the project is. As per our organization requirements, the source code is present in directories not directly under the project directory. Initially we had the problem that all paths to the linked resources were absolute and did not work on other machines with different paths.

Right now, the solution we have for this is to set up a Linked Resource Path Variable that points to the root of the working folder. All other locations are based on that, so we can include source from folders like

${WORKING_BASE}/library1
${WORKING_BASE}/library2

The problem with this solution is that everyone that pulls the project has to set the WORKING_BASE variable correctly before opening the project for it to work. My question is, is there a way to make the Linked Resources relative to the location of the .project file? That would be ideal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无人接听 2024-10-06 08:31:23

从 Eclipse 3.6 (Helios) 开始,可以

打开项目属性并转到 Resources >链接资源>路径变量。

您可以在那里创建一个相对于现有变量的新变量。例如:
名称:MY_SOURCE_FOLDER
位置:${PROJECT_LOC}\..\src

这将向您的 .project 文件添加一个新的 Path 变量,其值如下:

$%7BPARENT-1-PROJECT_LOC%7D/src

表示 ${PARENT-1-PROJECT_LOC}/src,其中 < code>1 表示 PROJECT_LOC 以上 1 倍的父目录。

It is possible since Eclipse 3.6 (Helios)

Open the project properties and goto Resources > Linked Resources > Path Variables.

There you can create a new variable relative to an existing one. For instance:

Name: MY_SOURCE_FOLDER

Location: ${PROJECT_LOC}\..\src

This will add a new Path variable to your .project file with a value like:

$%7BPARENT-1-PROJECT_LOC%7D/src

meaning ${PARENT-1-PROJECT_LOC}/src, where the 1 means the parent directory 1 times above PROJECT_LOC.

ζ澈沫 2024-10-06 08:31:23

使用 eclipse 3.7,给出以下路径:

C:\projects\workspace\project1
C:\projects\workspace\project2

在project1中,您可以执行以下操作:

PROJECT_LOC => C:\projects\workspace\project1
PARENT-1-PROJECT_LOC => C:\projects\workspace
PARENT-2-PROJECT_LOC => C:\projects\
PARENT-1-PROJECT_LOC\project2 => C:\projects\workspace\project2

With eclipse 3.7, giving this path :

C:\projects\workspace\project1
C:\projects\workspace\project2

Within project1 you can do :

PROJECT_LOC => C:\projects\workspace\project1
PARENT-1-PROJECT_LOC => C:\projects\workspace
PARENT-2-PROJECT_LOC => C:\projects\
PARENT-1-PROJECT_LOC\project2 => C:\projects\workspace\project2
晨敛清荷 2024-10-06 08:31:23

使用 ${PROJECT_LOC} 而不是 ${WORKING_BASE}

例如:

${PROJECT_LOC}/library1

${PROJECT_LOC}/library2

由于项目位置是当前项目的基础,因此您可以在其后添加相对路径。

Use ${PROJECT_LOC} instead of ${WORKING_BASE}

Like:

${PROJECT_LOC}/library1

${PROJECT_LOC}/library2

Since project location is the base of the current project you can add relative path followed by it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文