Flex Projects and SVN

Problem:
Yesterday I got SVN all setup on my Mediatemple account, and feeling very accomplished, I checked in a couple of projects that I am working on. I then went on coding, committing changes as I they were made, and generally feeling very good about my new setup. Then last night I went mobile and wanted to work off my laptop for a while, no problem I figured since I can simply check out my source files and work on them from any other machine, this was definately not the case. I checked out the flex project I was working on to my laptop, began making a bunch of changes, then tried to run my project. This is where the problems started. When you commit a flex project into svn, the bin directory (by default) is ignored, and is not checked in with the rest of your project. This may not seem like a big deal, and in fact, in many cases is exactly what you want. The problem is this: when you try to run your project, an error is thrown because the bin directory does not exist, and as such Flex cannot find the html file that is associated with the Application file that you are trying to run.

Solution:
After much googling, and a lot of trial and error, I finally found the solution to my problem and it really has nothing to do with which files get committed into source control. The problem was in how I was checking out the files FROM source control. Using Subclipse in FlexBuilder, when you check out a branch to your local machine, you are presented with a dialogue (“Check out as”) that gives you two options for how your would like to checkout the project. Option 1 is to “Check out as a project configured using the New Project Wizard,” and option 2 is to “Check out as a project in the workspace.” I had been using option 2 all along, which works just fine if you are running an actionscript only project; however, if you are running a flex project, then you will need to selected option 1 as it will walk you through the steps of creating your bin directory, then when you try to run an application file, flex will automatically create any missing html files in your bin. One other important thing to note is that the above scenario will only work if you do NOT include your .project file in version control. If subclipse finds a .project file in the project you are trying to checkout, it will not give an option to check out the project using the new project wizard.

Problem solved, sanity restored, back to code.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button


Leave a Reply