如何将相对路径添加到FlexBuilder的构建路径?
有没有办法将条目添加到 FlexBuilder 的相对构建路径中?
我将有多个项目使用共享代码库,但我无法让它们引用该共享代码。 我可以使用绝对路径来做到这一点,但这不会很好地工作。 该代码(和项目)将进入源代码管理,而我团队中的其他人可能没有像我一样将存储库放在硬盘上的同一位置。 因此,虽然定义的路径可能在我的机器上工作,但在其他开发人员的机器上却不起作用。
FlexBuilder 的 UI 不允许我输入相对路径。 我尝试手动修改 .project 和 .actionScriptProperties 文件以添加相对路径,但项目无法打开。
Is there a way to add entries to FlexBuilder's build path that are relative?
I'm going to have multiple projects that will use a shared codebase, but I'm having trouble getting them to reference that shared code. I can do it with absolute paths, but that isn't going to work well. This code (and the projects) are going into sourcecontrol, and other people on my team probably don't have the repositories in the same place on their harddrive as I do. So, while the paths defined may work on my machine, it won't on the other developers' machines.
FlexBuilder's UI wouldn't let me input a relative path. I tried modifying the .project and .actionScriptProperties files manually to add the relative paths, but then the project fails to open.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我个人会在我的 libs 文件夹中设置一个 svn external Flex 项目根目录。 然后,我将通过转到 {ROOT_PROJECT_FOLDER}>Properties>Flex Build Path>Source Path> 添加对源路径的引用。 添加文件夹 - 然后添加 libs 文件夹(该文件夹应该与您的项目相关)。 希望每次新结帐时您都应该获得外部库并拥有该项目的正确参考。 要做到这一点有点麻烦,但最终你还是能做到。
I'd personally set up an svn external in my libs folder of the flex project root. Then I'd add a reference to the source path by going to {ROOT_PROJECT_FOLDER}>Properties>Flex Build Path>Source Path> Add Folder - then add the libs folder (which should then be relative to your project). Hopefully then on every new checkout you should get the external library and have the correct references for the project. It is a bit fiddly to get this right but you get there in the end.
我最终所做的是正常创建项目,但然后重命名项目文件以在其末尾添加“-template”。 我将这些内容与 readme.txt 一起检查,其中详细说明了需要对模板文件进行的更改,以使它们可用作项目文件。
因此,当用户第一次获得该项目的最新信息时,他们必须从模板创建 FlexBuilder 项目,但希望之后他们不需要接触它。
我必须注意的一件事是项目参考。 最初我的项目引用了另一个 FlexBuilder 项目。 我发现尊重 SWC 本身比尊重项目更容易。
这不是最佳解决方案,但考虑到 FlexBuilder 无法处理相对路径,这是我能想到的最好解决方案。
What I ended up doing was to create the project normally, but then rename the project files to add a "-template" to the end of them. I checked those in along with a readme.txt detailing the changes that needed to be made to the template files to make them usable as project files.
So, the first time a user gets latest on that project they'll have to create the FlexBuilder project from the template, but hopefully after that they won't need to touch it.
One thing I had to be careful of was project references. Originally my project referenced another FlexBuilder project. I found it was easier to reverence the SWC itself instead of the project.
Not nearly the optimal solution, but it was the best I could come up with given that FlexBuilder can't handle relative paths.
如果我明白您想要什么,则两种方法之一可能会起作用(我正在使用 Flex 构建器 3):
选项#1 - 创建一个 Flex 构建“Flex 库项目”来保存您的共享源代码。 在使用项目的属性>中 Flex 构建路径 > 库路径,添加“共享”项目作为参考。
选项#2 - 将目录添加到项目的“属性”> Flex 构建路径 > 源路径。 正如您所指出的,构建器使用完全限定的路径。 我保存了项目,退出了 Flex Builder 并编辑了 .actionScriptProperties - 神奇之处似乎在于使用工作区中项目之一的名称,就好像它是完全限定的一样:
尝试改变:
到
If I understand what you are wanting, one of the two approaches might work (I'm using Flex builder 3):
Option #1 - create a flex build "Flex Library Project" to hold your shared source. In the consuming project's Properties > Flex Build Path > Library Path, add the "shared" project as a reference.
Option #2 - add directory to project's Properties > Flex Build Path > Source Path. As you noted, builder uses a fully qualified path. I saved the project, exited Flex Builder and edited .actionScriptProperties - the magic seems to be to use the name of one of the projects in your workspace as if it was fully qualified:
Try changing:
to
我很幸运,只需手动编辑
.actionScriptProperties
并自己添加相对路径:但是,这确实有一个缺点,即 FlexBuilder 不够智能,无法意识到链接源何时改变; 这是由
.project
处理的(FlexBuilder 不是很棒吗?)。为了解决这个问题,我将
.project_skel
文件提交给源代码管理,开发人员将其复制到位,修复绝对路径,然后将项目导入 FlexBuilder。I've had a lot of luck simply hand-editing
.actionScriptProperties
and adding the relative paths myself:However, this does have the drawback that FlexBuilder isn't smart enough to realize when the linked source is changed; that is handled by
.project
(isn't FlexBuilder wonderful?).To deal with that, I've committed
.project_skel
files to source control which developers copy into place, fixing the absolute paths, before importing the project into FlexBuilder.您是否尝试过
导入项目
选项?Have you tried
Import Project
option?