Recently a new archetype has been added to Flexmojos "flexmojos-archetypes-mobile-application". With this archetpye you can create an example project, that should be able to produce:

  • Air application
  • Native Android with shared runtime
  • Native Android with capture runtime
  • Native iOS
  • Native Windows
  • Native Mac
  • Several Linux packagings (Probably you have to reduce the Air version for this to work)

However work on Mobile packaging is a work in progress in Flexmojos. Currently Air and both Andoid flavors seem to be working niceley. Most of the others produce output, but that output doesn't seem to work ... yet. Regarding Mac and Windows packaging. It seems that in order to package Windows, you need a Windows machine, in order to package Mac, you need a Mac ... I have no idea if this is a hard restriction. Eventually there might be a way around this restriction, but I'm working on it.

There is one thing I should notice regarding the iOS packaging: In order to use this, you need an Apple developer account, an Apple certificate as well as a provisioning profile. Certificate and Provisioning Profile are both resources you have to get from your Apple developer account and locate them somewhere safe on your machine. In my settings.xml I then define the 3 properties: 

  • ios-certificate
  • ios-password
  • ios-provisioning-profile

While ios-certificate and ios-provisioning-profile contain the full path to the certificate and provisioning-profile files.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apace.flex.examples</groupId>
    <artifactId>mobile-example</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>air</packaging>

    <build>
        <sourceDirectory>src/main/flex</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>net.flexmojos.oss</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>7.1.0</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>default-package-air</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <storepass>flexmojos</storepass>
                        </configuration>
                    </execution>
                    <!--
                        Packaging for Windows
                    -->
                    <execution>
                        <id>package-windows-shared</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>windows</targetPlatform>
                            <classifier>windows</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-windows-captive</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>windows</targetPlatform>
                            <includeCaptiveRuntime>true</includeCaptiveRuntime>
                            <classifier>windows-captive</classifier>
                        </configuration>
                    </execution>
                    <!--
                        Packaging for Mac
                    -->
                    <execution>
                        <id>package-mac-shared</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>mac</targetPlatform>
                            <classifier>mac</classifier>
                        </configuration>
                    </execution>
                    <!--
                        This variant produces a directory as output.
                        Therefore mavens "install" goal fails with an error ...
                        need to zip that up first.
                    -->
                    <execution>
                        <id>package-mac-captive</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>mac</targetPlatform>
                            <includeCaptiveRuntime>true</includeCaptiveRuntime>
                            <classifier>mac-captive</classifier>
                        </configuration>
                    </execution>
                    <!--
                        Packaging for linux
                    -->
                    <execution>
                        <id>package-linux-debian-shared</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>linux-debian</targetPlatform>
                            <classifier>debian</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-linux-rpm-shared</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>linux-rpm</targetPlatform>
                            <classifier>rpm</classifier>
                        </configuration>
                    </execution>
                    <!--
                        Packaging for Android
                    -->
                    <execution>
                        <id>package-android-shared</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>android</targetPlatform>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-android-captive</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>android</targetPlatform>
                            <includeCaptiveRuntime>true</includeCaptiveRuntime>
                            <classifier>captive</classifier>
                        </configuration>
                    </execution>
                    <!--
                        Packaging for ios
                    -->
                    <execution>
                        <id>package-ios</id>
                        <goals>
                            <goal>package-air</goal>
                        </goals>
                        <configuration>
                            <targetPlatform>ios</targetPlatform>
                            <iosPackagingType>ipa-debug</iosPackagingType>
                            <storefile>${ios-certificate}</storefile>
                            <storepass>${ios-password}</storepass>
                            <iosProvisioningProfile>${ios-provisioning-profile}</iosProvisioningProfile>
                        </configuration>
                    </execution>
                </executions>

                <configuration>
                    <debug>true</debug>
                    <storepass>flexmojos</storepass>
                    <sourceFile>MobileApplication.mxml</sourceFile>
                </configuration>

                <dependencies>
                    <dependency>
                        <groupId>com.adobe.air</groupId>
                        <artifactId>compiler</artifactId>
                        <version>18.0</version>
                        <type>pom</type>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.flex</groupId>
            <artifactId>framework</artifactId>
            <version>4.14.1</version>
            <type>pom</type>
        </dependency>

        <!-- Add the components optimized for mobile use -->
        <dependency>
            <groupId>org.apache.flex.framework</groupId>
            <artifactId>mobile</artifactId>
            <version>4.14.1</version>
            <type>pom</type>
        </dependency>

        <!-- Add the default mobile skin -->
        <dependency>
            <groupId>org.apache.flex.framework.themes</groupId>
            <artifactId>mobile</artifactId>
            <version>4.14.1</version>
            <type>swc</type>
            <scope>theme</scope>
        </dependency>

        <!-- Air runtime dependencies -->
        <dependency>
            <groupId>com.adobe.air</groupId>
            <artifactId>framework</artifactId>
            <version>18.0</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>org.apache.flex.flexunit</groupId>
            <artifactId>flexunit-flex</artifactId>
            <version>4.3.0-SNAPSHOT</version>
            <type>swc</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

In order to get started, check out this

  • No labels

1 Comment

  1. Settings file, for reference.

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
    http://maven.apache.org/xsd/settings-1.0.0.xsd">
    	<ios-certificate>{full-path-of-ios-certificate}<ios-certificate/>
    	<ios-password>{ios-password}</ios-password>
    	<ios-provisioning-profile>{full-path-of-ios-provisioning-profile}}</ios-provisioning-profile>
    </settings>