Getting error "org.apache.flex.compiler:mxmlc:jar" when trying to compile with FlexMojos 7.0.1 and Apache Flex 4.14

662 Views Asked by At

I'm migrating an application I had working with Adobe Flex 4.6 and FlexMojos 4 to Apache Flex 4.14 and FlexMojos 7. When I try to execute "mvn build" I'm getting this error:

[ERROR]     Unresolveable build extension: Plugin net.flexmojos.oss:flexmojos-maven-plugin:7.0.1 or one of its dependencies could not be resolved:
The following artifacts could not be resolved:
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427, 
org.apache.flex.compiler:digest:jar:4.12.1.20140427, 
org.apache.flex.compiler:optimizer:jar:4.12.1.20140427, 
org.apache.flex.compiler:asdoc:jar:4.12.1.20140427, 
org.apache.flex.compiler:swcdepends:jar:4.12.1.20140427, 
org.apache.flex:compiler:pom:4.12.1.20140427: Failure to find 
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427 in 
http://repository.sonatype.org/content/groups/flexgroup/ was cached in the local repository, resolution will not be reattempted until the update interval of flex-mojos-repository has elapsed or updates are forced -> [Help 2]
[ERROR]     Unknown packaging: swf @ line 5, column 13

This is my pom.xml:

<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>com.cognifit.cognifitSocialFlex</groupId>
    <artifactId>FlexCognifit</artifactId>
    <packaging>swf</packaging>
    <name>cognifitSocialFlex</name>
    <version>11.0.2.10</version>

    <properties>
        <flex.version>4.14.1.20150325</flex.version>
        <flashplayer.version>11.1</flashplayer.version>
    </properties>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <directory>${project.basedir}/target/${project.version}</directory>
        <plugins>
            <plugin>
                <groupId>net.flexmojos.oss</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>7.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <sourceFile>CpcSocialFlex.mxml</sourceFile>
                    <swfVersion>13</swfVersion>
                    <targetPlayer>11.1.0</targetPlayer>

                    <localesCompiled>
                        <locale>ar_MA</locale>
                        <locale>de_AT</locale>
                        <locale>de_CH</locale>
                        <locale>de_DE</locale>
                        <locale>el_GR</locale>
                        <locale>en_US</locale>
                        <locale>en_ZA</locale>
                        <locale>es_ES</locale>
                        <locale>es_MX</locale>
                        <locale>fr_FR</locale>
                        <locale>he_IL</locale>
                        <locale>it_IT</locale>
                        <locale>ja_JP</locale>
                        <locale>ko_KR</locale>
                        <locale>nl_NL</locale>
                        <locale>pt_BR</locale>
                        <locale>pt_PT</locale>
                        <locale>ru_RU</locale>
                        <locale>sr_RS</locale>
                        <locale>tr_TR</locale>
                        <locale>zh_CN</locale>
                        <locale>zh_HK</locale>
                    </localesCompiled>

                    <dependencies>
                        <dependency>
                            <groupId>org.apache.flex</groupId>
                            <artifactId>compiler</artifactId>
                            <version>${flex.version}</version>
                            <type>pom</type>
                        </dependency>
                    </dependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.flex</groupId>
            <artifactId>framework</artifactId>
            <version>${flex.version}</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>com.adobe.flash.framework</groupId>
            <artifactId>playerglobal</artifactId>
            <version>${flashplayer.version}</version>
            <type>swc</type>
        </dependency>

        <dependency>
            <groupId>com.adobe.flex.framework.themes</groupId>
            <artifactId>halo</artifactId>
            <type>swc</type>
            <scope>theme</scope>
            <version>${flex.version}</version>
        </dependency>
    </dependencies>
</project>

I'm using Maven 3.2.5 and Java 1.6.0_14:

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/maven
Java version: 1.6.0_14, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_14/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.21.7-2.fc8xen", arch: "i386", family: "unix"

These are the steps I have followed:

I downloaded the Apache Flex SDK with the Installer:

  • Apache Flex SDK 4.14.1
  • AIR 18.0
  • Flash Player 18

enter image description here

I have used the Mavenizer to create a Maven version of this SDK:

enter image description here

Then I have deployed the mavenized version in my /root/.m2/repository/ folder and executed mvn compile with the pom.xml.

1

There are 1 best solutions below

0
On

By the way in the meanwhile the mavenizer has evolved quite a bit ... making usage of maven extensions by ".mvn/extensions.xml" files. This should automatically download, convert and install the Flex/Flash/Air resources you reference. So to upgrade to the next Flex/Flash/Air version, just reference a new version and the plugin will take care of the rest (As long as the version actually exists). See more details here: https://cwiki.apache.org/confluence/display/FLEX/Preparing+FDKs+for+Maven+builds (Pay some special attention to the chapter: Prepare the FDK resources using the flex-sdk-converter-maven-extension)