19
Aug

Compile Flex App with License Number

These days I had to deal with an error when trying to execute some functional tests.

Problem

After 30 playbacks or recordings the automation agent within Flex SDK stopped with the error “License not present. With the trial verison only limited replays are allowed.”

My Flex application was compiled with Flex SDK 4.1.0.16076 and with Maven. When compiled with a registered Flex Builder, the licensing information is automatically added into the flex app so you don’t have this problem anymore.

The problem is most likely to appear when building from a Continuous Integration machine and you need to use ant or maven, instead of Flash Builder.

Solution

In order to get rid of the error I had to compile the Flex application with a valid serial number of Flash Builder. To find out how to provide a license number, I looked at the mxmlc options:

osx:bin dragos$ ./mxmlc -help details licenses
Adobe Flex Compiler (mxmlc)
Version 4.1.0 build 16076
Copyright (c) 2004-2009 Adobe Systems, Inc. All rights reserved.

-licenses.license
    alias -license
    specifies a product and a serial number.  (repeatable)

Knowing my serial number, I asked myself what should I put as product name.
Looking on the internet I found people using “flexbuilder3” in the following way:
-licenses.license flexbuilder3 xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

What I didn’t find on the internet is that for Flash Builder 4, the product name has changed:
-licenses.license flashbuilder4 xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

Since I was building with Maven on the continuous integration machine, I had to find a way to add the license information to flexmojos:

<plugin>
    <groupId>org.sonatype.flexmojos</groupId>
    <artifactId>flexmojos-maven-plugin</artifactId>
    <version>${flex-mojos.version}</version>
    <extensions>true</extensions>
 
    <dependencies>
        <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>compiler</artifactId>
            <version>${flex.sdk.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>
 
<configuration>
    <configurationReport>true</configurationReport>
    <licenses>
        <flashbuilder4>${fb.license}</flashbuilder4>
    </licenses>
    </configuration>
</plugin>