有没有办法设置相对于 .project 文件的链接资源?
我们有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 Eclipse 3.6 (Helios) 开始,可以
打开项目属性并转到 Resources >链接资源>路径变量。
您可以在那里创建一个相对于现有变量的新变量。例如:
名称:MY_SOURCE_FOLDER
位置:${PROJECT_LOC}\..\src
这将向您的 .project 文件添加一个新的 Path 变量,其值如下:
表示
${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:
meaning
${PARENT-1-PROJECT_LOC}/src
, where the1
means the parent directory 1 times above PROJECT_LOC.使用 eclipse 3.7,给出以下路径:
在project1中,您可以执行以下操作:
With eclipse 3.7, giving this path :
Within project1 you can do :
使用 ${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.