Q. I get an error when trying to build my project: java.lang.OutOfMemoryError: Java heap space?

A. You need to set the environment variable MAVENOPTS to a larger Java heap space value, usually a number between 512 and 1024 MB works the best. For example:

MAVEN_OPTS=-Xmx512m

Q. What is included on Flex SDK released on Flexmojos maven repository?

A. Flexmojos does release the opensource version of FDK, the MPL one. That includes Flex and Air frameworks, spark, rpc, localization, rsls and a few other things included on MPL version.

That mean no font-kit, no license, no agl graphics and obvious no Flashbuilder (former Flexbuilder) components like automation and datavisualization nor LCDS components. If you need any of those you will need to manually install it. Check this for more help.


Q. How to get flexmojos working with a different flex SDK version?

A. To do that, Maven 2.0.9 is mandatory.

Once the desired version is available at flex SDK, is necessary to inform maven to use this new version at 2 distinct points, both on pom.xml.

First change plugin dependency:

<build>
  <plugins>
    <plugin>
      <groupId>org.sonatype.flexmojos</groupId>
      <artifactId>flexmojos-maven-plugin</artifactId>
      <dependencies>
        <dependency>
          <groupId>com.adobe.flex</groupId>
          <artifactId>compiler</artifactId>
          <version>{your version}</version>
          <type>pom</type>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.compiler</groupId>
          <artifactId>asdoc</artifactId>
          <version>{your version}</version>
          <classifier>template</classifier>
          <type>zip</type>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>

Then change project dependency:

<project>

  <build>...</build>

  <dependencies>
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>flex-framework</artifactId>
      <version>{your version}</version>
      <type>pom</type>
    </dependency>
  </dependencies>
</project>

Q. How do I get rid of the watermark on my datavisualization charts or the automation trial limit?

A. You need to have a valid Flex Builder 3 Professional license key. If you run flex-mojos on a machine that has Flex Builder 3 Professional installed, flex-mojos will automatically detect your license key. If not, then you need to put your license key in your pom like this (the dashes are optional):

<build>
  <plugins>
    <plugin>
      <groupId>org.sonatype.flexmojos</groupId>
      <artifactId>flexmojos-maven-plugin</artifactId>
      <configuration>
        <licenses>
          <flexbuilder3>nnnn-nnnn-nnnn-nnnn-nnnn-nnnn</flexbuilder3>
        </licenses>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>com.adobe.flex</groupId>
          <artifactId>license</artifactId>
          <version>${flex.sdk.version}</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>


Important: Note that the dependency on license.jar is for the plugin not the project.&nbsp;

Now, you need to install manually license.jar on maven repo. Maven will provide detailed install instructions at first time you try to compile this project. License.jar is available on the non-MPL Adobe SDK or on the SDK from you Flex Builder installation. To clarify, flexmojos repository only contains with the MPL version of the Flex SDK and doesn’t support licensing.

If you still see the watermark, then either the license key is invalid, or you do not have the correct license.jar on the maven classpath when it compiles the Flex project. You can run:

mvn install -X

to show the detailed maven output, and you should see something like this in your build (with or without dashes is fine):

-licenses.license flexbuilder3 nnnnnnnnnnnnnnnnnnnnnnnn

and

[DEBUG]     com.adobe.flex.compiler:license:jar:3.0.0.477:compile
(selected for compile)

or

[DEBUG]   (f) pluginArtifacts = [........,
com.adobe.flex.compiler:license:jar:3.0.0.477:compile,......

Q. How do I create a SWC with all test classes?

A. You need to execute the test-swc goal. That can be achieve by adding this on pom:

<build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <configuration/>
        <executions>
          <execution>
            <goals>
              <goal>test-swc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

test-swc goal will reuse all configuration declared on flexmojos-maven-plugin


Q. How to fix font rendering issues?

A. Flex SDK depends on flex-fontkit library to embed fonts. But this library isn’t opensource. So is necessary to manually install on maven repo and then inform flexmojos to use it.

First, install flex-fontkit using install-file mojo. It goes like this:

mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=flex-fontkit -Dversion=${flex.sdk.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${flex.sdk.path}/lib/flex-fontkit.jar

Then add the flex-fontkit dependency to flexmojos dependencies:

<build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <configuration/>
        <dependencies>
          <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>flex-fontkit</artifactId>
            <version>${flex.sdk.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

Read more...


Q. How to fix font embedding (transcoding) issues?

A. The default font manager is quite old and the improved version from adobe is not enabled by default. You need to activate it through configuration.

You need to install the dependencies to your own maven repository and declare the new font manager in your pom.

<build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <configuration>
          <fonts>
            <managers>
              <manager>flash.fonts.AFEFontManager</manager>
            </managers>
          </fonts>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>flex-fontkit</artifactId>
            <version>${flex.sdk.version}</version>
          </dependency>
          <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>afe</artifactId>
            <version>${flex.sdk.version}</version>
          </dependency>
          <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>aglj32</artifactId>
            <version>${flex.sdk.version}</version>
          </dependency>
          <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>rideau</artifactId>
            <version>${flex.sdk.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
</build>

If you get the error ’exception during transcoding: No FontManager provided’, make sure you have declared the dependencies under the flexmojos-maven-plugin and not at the top-level project dependencies.


Q. How do I get help on Flexmojos usage?

A. Basically there are 3 possible choices: 1 - For self studies, reading this Wiki, maven docs site (http://sites.sonatype.org/flexmojos/) and the sources 2 - Using community strength at user list, you can browser history (http://groups.google.com/group/flex-mojos) or ask (flex-mojos@googlegroups.com). BTW, when you got an answer for a very complicated question, you can consider sharing this knowledge on this wiki. 3 - Get paid support from Sonatype (http://sonatype.com/solutions/support), sometimes you need someone looking at your code, but you can’t publish on user list due to licensing issues.

On each way you will get help.


Q. How To Specify Flash Player Target Version?

A. Detailed article located here: https://docs.sonatype.org/display/FLEXMOJOS/How+To+Specify+Flash+Player+Target+Version


Q. When I build it with FlexBuilder/FlashBuilder everything works fine, but when I build it using Flexmojos something goes wrong…

A. Well, obviously something differs from the IDE build and maven build. The most obvious way to figure out where is the difference is comparing the dump config.xml. On IDE add "-dump-config filename.xml" on Additional compiler arguments under project properties/Flex Compiler. On Maven set configurationReport to true. Then compare it using your favorite tool and adjust your until both produces the same result.


Q. What to do if there is no way to get tests working properly?

A. Please refer to: https://docs.sonatype.org/display/FLEXMOJOS/Running+unit+tests#Runningunittests-noway


Q. How can I create and install a Maven dependency in my local repository from a 3rd party Flex component?

A. The easiest way to reference a 3rd-party dependency from a Flex project under Maven is to have the dependency in your pom.xml. Some packages don’t offer their code as Maven packages, in which case you can install the primary libraries to your local repository.

This example uses the Adobe Data Visualization framework, which is available on Adobe's site. This framework is actually available in the Sonatype repository:

<groupId>com.adobe.flex.framework</groupId>
<artifactId>datavisualization</artifactId>
<version>4.0.0.13555</version>

The version is not compatible with the code that I’m currently working on, though, so I needed to use the earlier 3.5-compatible version.

The files that you need to place in the repo are the swcs for the target library. In the case of data visualization, these are:

frameworks/libs/datavisualization.swc
frameworks/locale/en_US/datavisualization_rb.swc
frameworks/locale/ja_JP/datavisualization_rb.swc

The first is the main code package for the data visualization library. The other two are resource bundles for localized messages. These all need to be installed in the local repository. The basic command looks like this:

mvn install:install-file -DgroupId=com.adobe.flex.framework 
    -DartifactId=datavisualization -Dversion=3.5.0.12683 -Dpackaging=swc 
    -Dfile=frameworkslibsdatavisualization.swc

This is pretty self-explanatory. Install a file under the given group and artifact ID with the indicated version. Package it as an SWC. The file to use is the one specified by -Dfile=.

Now you need to install the resource bundles. There are two main differences here:

  • Instead of swc, you want the packaging to be rb.swc.
  • You need to add the -Dclassifier={}{}xxXX{}, where {}xxXX{} is the indicated locale, e.g. enUS. The exception to this is that your default resource bundle should be installed twice: once with the classifier and once without.

So the commands for installing the resource bundles shown above look like this:

mvn install:install-file -DgroupId=com.adobe.flex.framework 
    -DartifactId=datavisualization -Dversion=3.5.0.12683 -Dpackaging=rb.swc 
    -Dfile=frameworkslocaleen_USdatavisualization_rb.swc
mvn install:install-file -DgroupId=com.adobe.flex.framework 
    -DartifactId=datavisualization -Dversion=3.5.0.12683 -Dpackaging=rb.swc 
    -Dfile=frameworkslocaleen_USdatavisualization_rb.swc -Dclassifier=en_US
mvn install:install-file -DgroupId=com.adobe.flex.framework
    -DartifactId=datavisualization -Dversion=3.5.0.12683 -Dpackaging=rb.swc 
    -Dfile=frameworkslocaleja_JPdatavisualization_rb.swc -Dclassifier=ja_JP

Once this is done, you can refer to your new bundle in your pom.xml with a dependency block:

<dependency>
    <groupId>com.adobe.flex.framework</groupId>
    <artifactId>datavisualization</artifactId>
    <version>3.5.0.12683</version>
    <type>swc</type>
</dependency>