Debugging Flex Applications with RSLs or runtime locales

Debugging a Flex application is easy as long as the SWF is self contained. If however your application makes use of Runtime Shared Libraries (RSLs) or runtime locales you are going to have trouble. 

The reason for this trouble is that the application SWF is expecting other resources to be located relative to itself. In a normal multi-module build the SWF will however reside in its modules "target" directory without any of the dependencies. As soon as you try to start the application it will fail to load the related resources. In order to work around this debugging the SWF in the final application WAR was an option.

With latest changes in Flexmojos 7.1.0 however a new option has been added to the toolbox.

The "copy-flex-resources" goal, which initially only worked in WAR projects, was modified to also work in SWF projects. In contrast to the WAR version, the SWF version doesn't iterate over all SWF dependencies, but uses itself as root.

<plugin>
    <groupId>net.flexmojos.oss</groupId>
    <artifactId>flexmojos-maven-plugin</artifactId>
    <version>7.1.0</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <id>copy-test-resources</id>
            <goals>
                <goal>copy-flex-resources</goal>
            </goals>
        </execution>
    </executions>
</plugin>

By defining the above execution, Flexmojos will automatically dump all related resources to the "target" directory, enabling the developer to directly debug the created SWF.

I would however suggest to add this into a dedicated profile. You don't want this to be executed on a CI server and don't need it executed during a normal build. You only need it to be executed if you are planning on debugging the application. Therefore I would suggest to have this goal only executed if your "debug" profile is enabled.

This is a very new feature and hasn't been testes as much as the other features ... so if you are having problems, feel free to report them on the Flex mailing lists and we'll get the problems sorted out as soon as possible.

  • No labels