Abstract

The Mavenizer tool is used to convert the Apache Flex SDKs and Adobe Air SDKs into Maven artifacts. Automatically creating the Directories, pom-files, copying and moving the resources to the correct destinations. These artifacts can then be used in Maven builds using the Flexmojos plugin (Starting with version 7.x).However we are working on a new Apache Maven plugin, but this will take quite a while till it's finished. Until that's done, please feel free to use Flexmojos 7.x branch. https://flexmojos.atlassian.net/wiki/display/FLEXMOJOS/Home. Currently development of Flexmojos is done at GITHub and the source is available at: https://github.com/chrisdutz/flexmojos

The Mavenizer consists of several parts:

  • Retrievers
  • Converters
    • Flex Converter (Converts a Flex SDK)
    • Flash Converter (Converts an Air SDK)
    • Air Converter (Converts the playerglobal for a given Flash version)
  • Deployers
    • Aether Deployer (Deploys the artifacts directly from inside the Mavenizer VM, a lot faster, but possibly less stable and less options)
    • Maven Deployer (Deploys the artifacts using a locally installed Maven version)

The Mavenizer modules were built in a way that they can be utilized by external tools especially Flexmojos, which is able to automatically download and mavenize AIR and Flash resources.

Building the Mavenizer

Here come the steps needed to build the Generator (Assuming you already have a working Maven installation)

  • Clone the flex-utilities repo (https://git-wip-us.apache.org/repos/asf/flex-utilities.git)
  • Checkout the "develop" branch. (The "flex-maven-tools" directory I will call [home] from now on)
  • Go to the directory [home]
  • Execute "mvn package"
  • /flex-utilities/flex-maven-tools/flex-sdk-converter (develop)

    $ mvn package

  • This process takes about 5 minutes at max to complete, so enjoy a cup of coffee

    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO]
    [INFO] apache-flex-sdk-converter .......................... SUCCESS [01:11 min]
    [INFO] api ................................................ SUCCESS [ 22.942 s]
    [INFO] retrievers ......................................... SUCCESS [  0.026 s]
    [INFO] base-retriever ..................................... SUCCESS [  7.070 s]
    [INFO] download-retriever ................................. SUCCESS [01:09 min]
    [INFO] converters ......................................... SUCCESS [  0.021 s]
    [INFO] base-converter ..................................... SUCCESS [  2.210 s]
    [INFO] air-converter ...................................... SUCCESS [  0.242 s]
    [INFO] flash-converter .................................... SUCCESS [  1.524 s]
    [INFO] fontkit-converter .................................. SUCCESS [  0.121 s]
    [INFO] wrapper-converter .................................. SUCCESS [  0.129 s]
    [INFO] flex-converter ..................................... SUCCESS [  0.409 s]
    [INFO] deployers .......................................... SUCCESS [  0.020 s]
    [INFO] maven-deployer ..................................... SUCCESS [  9.167 s]
    [INFO] aether-deployer .................................... SUCCESS [ 17.329 s]
    [INFO] cli ................................................ SUCCESS [  2.999 s]
    [INFO] flex-sdk-converter-maven-extension ................. SUCCESS [ 17.344 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 03:45 min
    [INFO] Finished at: 2016-01-22T10:26:11+13:00
    [INFO] Final Memory: 53M/873M
    [INFO] ------------------------------------------------------------------------

     

     

After the build is finished, the directory "flex-utilities/flex-maven-tools/flex-sdk-converter/maven-extension/target" should now have a jar file called "flex-sdk-converter-1.0.0-SNAPSHOT.jar" this jar contains all you need to mavenize a FDK. If you are however trying to embed mavenization capabilities into a dedicated tool, using the individual artifacts is recommendable.

 

 

If you are on master branch, the mavenizer directory will exists

mavenizer only exists on master branch, in the develop branch it's called flex-maven-tools

 

Using the Mavenizer

Warning

I would suggest not to generate the artifacts into your local repo directly, but to generate it to an empty directory and then move it from there. This makes especially deploying the FDK to a remote repository a lot easier.

 

  1. Prepare the directories:
    1. Use the Flex Installer to download the Flex SDK as well as the Flash and AIR versions you intend on using (I'll call the installation directory "sdkhome")
    2. Create a directory anywhere which will contain the output (I will call it "fdktarget" from now on)
  2. Change to the "sdkhome" directory
  3. Execute the following command:

    java -jar [home]/core/target/flex-sdk-converter-1.0.0-SNAPSHOT.jar "[sdkhome]" "[fdktarget]"

    (You should wrap the both directory names in double-quotes if they contain spaces)

  4. In order to use the generated Maven version, simply copy all files in "fdktarget" to your maven local repository.

Deploying your artifacts to a remote Maven repository

The SDK deployers allow you to deploy any maven structured directory to a remote maven repository as soon as you've got the remote rights. So be sure not to deploy your maven local repository to a remote as this will deploy everything and not only your flex sdks.

Using the Aether deployer

java -jar [home]/deployers/aether/target/aether-deployer-1.0.0-SNAPSHOT-full.jar "fdktarget" "repository-url" ["username", "password"]

The AetherDeployer needs 2 or 4 ordered parameters separated by spaces:

  1. fdktarget: The path to the directory the SDKGenerator generated its artifacts to.
  2. repository-url: The url of the maven repository we want to deploy the artifacts to.
  3. username: (optional) The username used to deploy the artifacts.
  4. password: (required only if a username is provided) The password used to deploy the artifacts.

Using the Maven deployer

java -jar [home]/deployers/maven/target/maven-deployer-1.0.0-SNAPSHOT-full.jar "directory" "repositoryId" "url" "mvn"

The MavenDeployer needs 4 ordered parameters separated by spaces:

  1. directory: The path to the directory to deploy.
  2. repositoryId: Server Id to map on the <id> under <server> section of settings.xml.
  3. url: URL where the artifacts will be deployed. 
  4. mvn: The path to the mvn.bat / mvn.sh.

Some specialities with certain FDKs

Flex SDK 2.0:

Version is strange "3.0 Moxie M2.180927". Has to be changed to 2.0.1.180927 in flex-sdk-description.xml 

Flex 3.0.0.477A, Flex 3.0.1.1732A, Flex 3.2.0.3958A

I did have some trouble finding out the AIR version as well as the binary artifacts. The sizes and checksums of the airglobal.swc didnt match any of the official AIR artifacts and the adl command didn't output a version. Currently without tweaking these FDKs are generated without working AIR support.

If however you need one of these FDKs you can simply make the generator use the air version you want, by copying the airglobal.swc of the version you want to use into thedirectory "fdkroot/frameworks/libs/air" assuming you have deployed any FDK or Air SDK containing that version of airglobal, the generator will correctly add dependencies to that AIR version.

Flex 4.8.0.1359417

  • Needs a "player" directory in "framework" in order to execute compc (Copy from Flex 4.6.0).
  • Needs all the dependencies in place "textlayout", "osmf" and the stuff that needs to be copied into the "[fdkroot]/lib/external" and "[fdkroot]/lib/external/optional" directories. For more instructions on this, please read the README.txt in the root of Your FDK.
  • Needs to detect the AIR version the FDK is compatible with, this is currently determined by checking the version of the airglobal.swc in the framework/libs/air/airglobal.swc. Simply copy this from the 4.6 FDK

Download Links to binary versions of Flex and Air  

AIR SDKs (From Adobe):  http://helpx.adobe.com/air/kb/archived-air-sdk-version.html

Flex SDKs (From Adobe): (Unfortunately the page seems messed-up, but you can get the URLs from there)http://sourceforge.net/adobe/flexsdk/wiki/downloads/

  • No labels

1 Comment

  1. Anonymous

    While using mavenizer for apache flex 4.9.1, I always get the below error. Any help appreciated.

    ---------------------------------------------
    – Generating Flex SDK version: 4.9.1.1447119
    ---------------------------------------------
    Exception in thread "main" java.lang.NullPointerException
    at java.util.Arrays$ArrayList.<init>(Unknown Source)
    at java.util.Arrays.asList(Unknown Source)
    at flex.FlexCompilerGenerator.process(FlexCompilerGenerator.java:43)
    at SDKGenerator.generateFlex(SDKGenerator.java:121)
    at SDKGenerator.generateAllFlex(SDKGenerator.java:111)
    at SDKGenerator.main(SDKGenerator.java:153)