FAQ

Skip to end of metadata
Go to start of metadata

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 MAVEN_OPTS 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>
Warning
The flex-framework version and compiler version must be the exact same

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

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 because it's not opensource, so you need to activate it through configuration.

As the needed dependencies are not opensource, they are not available on public repos. You need to install the dependencies to your own maven repository or install them in your local repository:

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
mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=rideau -Dversion=${flex.sdk.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${flex.sdk.path}/lib/rideau.jar
mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=afe -Dversion=${flex.sdk.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${flex.sdk.path}/lib/afe.jar
mvn install:install-file -DgroupId=com.adobe.flex -DartifactId=aglj32 -Dversion=${flex.sdk.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${flex.sdk.path}/lib/aglj32.jar

After, just 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 (4.1-beta) and the sources
2 - Using community strength at user list, you can search the forum history at (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.

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=frameworks\libs\datavisualization.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=xx_XX, where xx_XX is the indicated locale, e.g. en_US. 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=frameworks\locale\en_US\datavisualization_rb.swc
mvn install:install-file -DgroupId=com.adobe.flex.framework \
    -DartifactId=datavisualization -Dversion=3.5.0.12683 -Dpackaging=rb.swc \
    -Dfile=frameworks\locale\en_US\datavisualization_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=frameworks\locale\ja_JP\datavisualization_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>
<dependency>
    <groupId>com.adobe.flex.framework</groupId>
    <artifactId>datavisualization</artifactId>
    <version>3.5.0.12683</version>
    <type>rb.swc</type>
</dependency>

Q. Is the Maven Plugin Documentation available anywhere?

A. Yes. Flexmojos is currently hosting that inside nexus so multiple versions can be hosted at same time. The root folder is http://repository.sonatype.org/content/sites/flexmojos-site/
Some sample links:


Q. How do I configure the Adobe-signed Flex 4 RSL dependencies?

To avoid runtime loading errors, make sure the Adobe-signed Flex 4 RSL dependencies are listed first in your pom.xml file. You should match the order of the Adobe framework RSLs defined in sdks/4.1.0/frameworks/flex-config.xml by the order of the <runtime-shared-library-path> elements.

The RSL runtime loading sequence matches the Flex compiler SWC linking sequence. The flex-mojos plugin relies on Maven for dependency resolution and sequencing. Maven sequences the dependencies using the order specified in the dependencies section. Maven will use the first matching dependency encountered in the case of duplicates/conflicts.

Here is an example pom.xml snippet.


Q. How can I include/exclude test cases with Flexmojos?

By default flexmojos will include all test classes with the pattern: [*/Test.as, **/Test.as, **/Test.mxml, **/*Test.mxml], so, if you use a different naming pattern for tests you need to inform flexmojos that by using includeTestFiles and/or excludeTestFiles configurations. Snippet example:

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <configuration>
          <includeTestFiles>
            <include>**/integration/*IT.as</include>
          </includeTestFiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

Q. When compiling my application everything builds fine, but when I open the application the screen stays white. Why?

Since Flex 4.5.1 an application requires the swfVersion to be set to 11, strangely the default comming from the SDK is still 10. So the solution is to add a "<swfVersion>11</swfVersion>" to the Flexmojos configuration in order to have Flexmojos override this.

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <configuration>
          <swfVersion>11</swfVersion>
        </configuration>
      </plugin>
    </plugins>
  </build>

Q. I am getting Errors (NullPointerException) when building my war ... why?

There is an issue with Maven 3.0.3 and the scopes (rsl, caching, ...) and packaging types (swf, swc) of Flexmojos. The copy maven resources target usses default Maven functionality to check if there are any "finalName" settings for the referenced swf-resources. Unfortunately the packaging of these swf-modules cause Maven to return null instead of a maven model. This causes the NullPointerException. One solution, if you don't use finalName, is to set an additional config parameter "<useFinalName>false</useFinalName>". This simply skips the entire functionality that seems to be broken.

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>copy-flex-resources</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <useFinalName>false</useFinalName>
        </configuration>
      </plugin>
    </plugins>
  </build>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 07, 2009

    ppramod@sapient.com says:

    hi velo, is there any tutorial on multiple flex modules compiling using flexmoj...

    hi velo,

    is there any tutorial on multiple flex modules compiling using flexmojos in the same application. Like 

    FlexMojoApp
            |
            - main.mxml [main Flex application file]
                  |
                  - view [Folder]
                     |
                     - Login.mxml [module-1]
                     - MainLayout.mxml [module-2]

    i had done it like this in pom.
                <plugin>
                    <groupId>info.flex-mojos</groupId>
                    <artifactId>flex-compiler-mojo</artifactId>
                    <version>${flex-mojos.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <locales>
                            <param>en_US</param>
                        </locales>
                        <sourcePaths>
                            <path>${project.build.sourceDirectory}</path>
                        </sourcePaths>
    			<moduleFiles>
    	                    <module>/com/sape/standard/flex/view/module/Login.mxml</module>
    			    <module>/com/sape/standard/flex/view/module/MainLayout.mxml</module>
    	                </moduleFiles>
    			<optimize>true</optimize>
                        <contextRoot>java_webapp</contextRoot>
                        <showWarnings>false</showWarnings>
                    </configuration>
                </plugin>
    
    

    can you please tell us how to copy the modules to the war maven module. the copy tag is not working for the modules. And one more thing is, when compiling the modules the modules are placed on the same level of main swf file in target folder. is this correct? usally it should have been in the same folder structure as in source rite?.

    Thanks,

    Pramod

    1. Mar 23, 2009

      srinu16@hotmail.com says:

      Pramod i am not sure if it helps or not but take a look at my post: I am sure i...

      Pramod i am not sure if it helps or not but take a look at my post:

      I am sure i can improve it with some of the latest flex-mojos release and also some alternative approaches. But this is my first attemp to build Flex. So far this works fine and will improve it along my Flex journey

      http://www.libertyleap.com/skusunam/

    2. Aug 14, 2009

      fidelhl says:

      check out http://svn.sonatype.org/flexmojos/tags/flexmojos-3.2.0 update flexmojo...

      check out http://svn.sonatype.org/flexmojos/tags/flexmojos-3.2.0
      update flexmojos-maven-plugin\src\main\java\org\sonatype\flexmojos\compiler\ApplicationMojo.java
      modules is in the same folder structure as in source

    3. Aug 14, 2009

      Marvin Herman Froeder says:

      Track that at https://issues.sonatype.org/browse/FLEXMOJOS-53 VELO PS: Use use...

      Track that at https://issues.sonatype.org/browse/FLEXMOJOS-53

      VELO

      PS: Use user list to do questions.

  2. Aug 17, 2009

    stacy says:

    I follow the steps on "How to fix font embedding (transcoding) issues" and still...

    I follow the steps on "How to fix font embedding (transcoding) issues" and still get the problem below:
    [ERROR] /Users/jgu/depot/w4/trunk/client/flex/src/main/flex/skins/fonts.css:[58,-1] exception during transcoding: No FontManager provided. Cannot build font.
    [ERROR] /Users/jgu/depot/w4/trunk/client/flex/src/main/flex/skins/fonts.css:[58,-1] unable to build font 'Myriad Pro'

    Could you let me know what is missing?

    1. Aug 17, 2009

      Marvin Herman Froeder says:

      Hi, I removed most of your comment, too much code, logs.... https://docs.sonat...

      Hi,

      I removed most of your comment, too much code, logs....

      https://docs.sonatype.org/display/FLEXMOJOS/FAQ#FAQ-1.7

      VELO

      1. Feb 11, 2010

        rherrick@gmail.com says:

        I'm also seeing this error even though I have the font manager fix installed.&nb...

        I'm also seeing this error even though I have the font manager fix installed.  It was "working" before ....

        1. Feb 11, 2010

          rherrick@gmail.com says:

          Never mind, got this fixed.  I had to add the other font managers to the li...

          Never mind, got this fixed.  I had to add the other font managers to the list of managers to get this to work.

          Then, for fun, I removed ALL of the font manager stuff, which I had added because I'd initially had the font compile error.  Lo and behold, this time it built and the swf actually even ran (previously I was getting a very small output for the swf and it loaded but didn't run.

          Progress one small slow step at a time...

        2. Feb 11, 2010

          Marvin Herman Froeder says:

          Guys ask questions at users list: http://groups.google.com/group/flex-mojos I w...

          Guys ask questions at users list: http://groups.google.com/group/flex-mojos

          I won't even read questions posted as comments, I will probably just edit it and remove the body.

  3. Sep 15, 2009

    npacemo@gmail.com says:

    I think that the manual installation of the license.jar file into the local Mave...

    I think that the manual installation of the license.jar file into the local Maven repo needs further clarification and details.

    I've tried installing it with the following Maven command:

    $ mvn install:install-file \
       -Dfile=/Applications/Adobe\ Flex\ Builder\ 3\ Plug-in/sdks/3.3.0/lib/license.jar \
       -DgroupId=com.adobe.flex.compiler \
       -DartifactId=license.jar \
       -Dversion=3.3.0.4852 \
       -Dpackaging=jar
    

     But I keep getting in my mvn install the following warning:

    [WARNING] Unable to find license.jar on classpath. Check wiki for instructions about how to add it:
       https://docs.sonatype.org/display/FLEXMOJOS/FAQ#FAQ-1.3
    

    Thanks,

    Vladimir

    1. Oct 28, 2009

      Martin Todorov says:

      Hi, I'm afraid I have to agree with Vladimir on this one, as I had to find ou...


      Hi,

      I'm afraid I have to agree with Vladimir on this one, as I had to find out the hard way how to set up the licensing. Basically, the license dependency needs to be a dependency of the plugin itself. Therefore, I would like to suggest following the steps described below:

      To install to your local repository:

      mvn install:install-file -Dfile=/java/flex-3.4/lib/license.jar \
                               -DgroupId=com.adobe.flex \
                               -DartifactId=license \
                               -Dversion=3.4.0.9271 \
                               -Dpackaging=jar \
                               -DgeneratePom=true \
                               -DcreateChecksum=true
      

      To deploy to a remote repository:

      mvn deploy:deploy-file -Dfile=/java/flex-3.4/lib/license.jar \
                             -Durl=scp://maven@my.remote.host.com:/repositories/maven2/ \
                             -DrepositoryId=remote-host-id \
                             -DgroupId=com.adobe.flex \
                             -DartifactId=license \
                             -Dversion=3.4.0.9271 \
                             -Dpackaging=jar \
                             -DgeneratePom=true \
                             -DgeneratePom.description="Adobe Flex dependency for handling licenses."
      

      In your pom.xml you need to have something similar to this:

      ...
          <properties>
              <flex.sdk.version>3.4.0.9271</flex.sdk.version>
          </properties>
      
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.sonatype.flexmojos</groupId>
                      <artifactId>flexmojos-maven-plugin</artifactId>
                      <version>3.4.2</version>
      
                      <extensions>true</extensions>
      
                      <configuration>
                          <targetPlayer>10.0.0</targetPlayer>
                          <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>
       
      

      This should fix the warning you would otherwise get:

      [WARNING] Unable to find license.jar on classpath. Check wiki for instructions about how to add it:
         https://docs.sonatype.org/display/FLEXMOJOS/FAQ#FAQ-1.3
      
      1. Oct 28, 2009

        Marvin Herman Froeder says:

        Ow, sorry, that the link on the warning is wrong, my bad, I updated this page an...

        Ow, sorry, that the link on the warning is wrong, my bad, I updated this page and that changed the link to: https://docs.sonatype.org/display/FLEXMOJOS/FAQ#FAQ-Q.HowdoIgetridofthewatermarkonmydatavisualizationchartsortheautomationtriallimit%3F
        I re-add the anchor now the link for old version should be ok...

        If you find that information useless or incomplete fell free to edit it. But as far I can tell, the code sample does show the dependency inside the plugin section, people usually don't see that =/. Many complained about that, I asked for contributions and no one came with a better text.

        VELO