apache-flexmavenflexmojos

Flex & Maven : How to upgrade playerglobal version in pom.xml


I'm currently developping an flex application, and i've used native cursor support to dynamically change cursor in particular conditions.

My application runs with Flex Sdk 4.1.0.16076, which use flash player 10.0 by default. I have upgrade this version to 10.2 in project preferences, in order to use MouseCursorData class.

It works fine in eclipse but i'm using maven for dependencies and I have compilation error when doing a maven build, saying MouseCursorData Class can't be found.

It's pretty normal since i'm using player 10 in my dependencies. So I tried to update my pom.xml file for upgrading player to 10.2 :

     <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <configuration>
                <targetPlayer>10.0</targetPlayer>
                <compiledLocales>
                    <locale>en_US</locale>
                    <locale>fr_FR</locale>
                </compiledLocales>
                <warnings>
                    <noConstructor>false</noConstructor>
                </warnings>
                <sourceFile>Opale.mxml</sourceFile>
                <generateHtmlWrapper>true</generateHtmlWrapper>
                <contextRoot>opale-web</contextRoot>
                <services>${basedir}/src/main/resources/services-config.xml</services>
                <output>target/opale-ui.swf</output>
            </configuration>
            <version>${flexmojos.version}</version>
            <extensions>true</extensions>
            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <version>${flex.sdk.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>             
        </plugin>

First, I have changed the targetPlayer in flex mojo plugin from 10.0 to 10.2. Then I obtain the compilation error :

[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:compile-swf (default-compile-swf) on project opale-ui: TargetPlayer and playerglobal dependency version doesn't match! Target player: 10.2, player global: 10.0 -> [Help 1]

So, i had a dependency to force playerglobal version :

<dependency>
    <groupId>com.adobe.flex.framework</groupId>
    <artifactId>playerglobal</artifactId>
    <version>${flex.sdk.version}</version>
    <classifier>10.2.0</classifier>
    <type>swc</type>
</dependency>

Then, i have the following error :

Downloading:     http://repo.maven.apache.org/maven2/com/adobe/flex/framework/playerglobal/4.1.0.16076/playerglobal-4.1.0.16076-10.2.0.swc
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.698s
[INFO] Finished at: Wed Sep 12 12:29:57 CEST 2012
[INFO] Final Memory: 9M/124M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project opale-ui: Could not resolve dependencies for     project com.igc.opale:opale-ui:swf:1.9-SNAPSHOT: Could not transfer artifact     com.adobe.flex.framework:playerglobal:swc:10.2.0:4.1.0.16076 from/to jboss     (http://repository.jboss.org/maven2/): Access denied to:     http://repository.jboss.org/maven2/com/adobe/flex/framework/playerglobal/4.1.0.16076/playerglobal-4.1.0.16076-10.2.0.swc, ReasonPhrase:Forbidden. -> [Help 1]

I new to maven so maybe i'm doing this pretty badly.


Solution

  • You can configure this in plugins

    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <headlessServer>true</headlessServer>
                <verboseStacktraces>true</verboseStacktraces>
    
                <swfVersion>11</swfVersion>
                <targetPlayer>10.2</targetPlayer>
            ...
            </configuration>
        </plugin>
    </plugins>
    

    And dependency:

    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>playerglobal</artifactId>
        <version>4.5.1.21328</version>
        <classifier>10.2</classifier>
        <type>swc</type>
    </dependency>