Chris Cai's Tech Blog

博客园 首页 新随笔 联系 订阅 管理

One problem I've always had with Flex Builder is that I can't reuse projects which link to source folders outside of the main source folder. These external source folders are usually defined with an absolute file path, which makes the project files unusable by other developers without changes. And changes mean that project files don't stay in sync, which is just one more thing to worry about.

Usually, the external source folder is a folder for test files, but it can also be some folders that really should be in a SWC. In any case, the project file isn't sharable in the current form, and we all like to share.

I learned from some developers at Brightcove that there is a solution to this using a built-in Eclipse feature. First, you need to set up a linked resource:

1. In Flex Builder, go to "Window > Preferences".
2. Navigate to "General > Workspace > LinkedResources".
3. Within LinkedResource, create a new variable that links to the folder you want to include or some common base directory. Usually, you'd enter some base directory within source control that could be reused for more than one external source path.

Once you have the linked resource, you'll want to add a source path to your project. Right-click on the project, go into "Properties", "Flex Build Path", "Source Path". As normal, select "Add Folder", but don't browse to the directory. Instead, use the linked resource name, either by itself:

${LINKED_RESOURCE_NAME} 注意,是${} 而不是$()!!!

Or if it's a base directory, you can tack on directories:

${LINKED_RESOURCE_NAME}/my_source/location

OK it, and it's all set up. Then you can share the project file to other people on the team, or check it into source control. Each member of the team will need to define the linked resource, as shown in the steps above, but the project files don't have to change.

posted on 2010-01-17 16:13  Chris Cai  阅读(306)  评论(0编辑  收藏  举报