Specify the Flash Player Target Version

How To Specify Flash Player Target Version

To specify the target Flash player version, there are three items you need to add/edit in your POM file.

In this example we will set the target Flash Player to version 10.0.0 and use the Flex SDK version 3.4.0.9271.

1. First, in the compiler plugin, you need to include the target version under the <configuration> element of the <plugin>

<configuration>
   <targetPlayer>10.0.0</targetPlayer>
...

2. Second, you must include the specific version of the com.adobe.flex.framework.playerglobal dependency artifact that matches the flex SDK version you are using to compile the project. You also must include the <classifier> element to indicate the targeted player runtime (at the time of this writing the options are "9" or "10").

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

3. Lastly, because the Flex (3.x) framework by default includes the com.adobe.flex.framework.playerglobal dependency artifact for Flash player version 9, you must exclude this default dependency from the com.adobe.flex.framework.flex-framework dependency artifact; else it is automatically included as a transitive dependency.

<dependency>
  <groupId>com.adobe.flex.framework</groupId>
  <artifactId>flex-framework</artifactId>
  <version>3.4.0.9271</version>
  <type>pom</type>
  <exclusions>
    <exclusion>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>playerglobal</artifactId>
    </exclusion>
  </exclusions>
</dependency>


Sample POM File
<?xml version="1.0" encoding="UTF-8"?>
<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.company</groupId>
	<artifactId>test</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>swf</packaging>
	<name>TEST</name>

  <dependencies>
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>flex-framework</artifactId>
      <version>3.4.0.9271</version>
      <type>pom</type>
      <exclusions>
        <!-- make sure to exclude the default 'playerglobal' transitive dependency -->
        <exclusion>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>playerglobal</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>playerglobal</artifactId>
      <version>3.4.0.9271</version>  <!-- this artifact version must match the flex SDK version used in this project -->
      <classifier>10</classifier>  <!-- the classifier specifies the target flash player major version  -->
      <type>swc</type>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <version>3.3.0</version>
        <extensions>true</extensions>

        <!--  explicitly define the Flex SDK compiler version to use -->
        <dependencies>
          <dependency>
	    <groupId>com.adobe.flex</groupId>
	    <artifactId>compiler</artifactId>
            <version>3.4.0.9271</version>
            <type>pom</type>
          </dependency>
        </dependencies>

        <!--  configuration for the Flex compilation -->
        <configuration>
          <targetPlayer>10.0.0</targetPlayer>  <!-- compiler option specifying the target flash player version -->
          <incremental>false</incremental>
          <debug>false</debug>
          <locale>en_US</locale>
          <optimize>true</optimize>
          <showWarnings>true</showWarnings>
          <strict>true</strict>
          <useNetwork>true</useNetwork>
          <allowSourcePathOverlap>true</allowSourcePathOverlap>
          <sourcePaths>
            <path>${basedir}/src/main/flex</path>
          </sourcePaths>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>flex-mojos-repository</id>
      <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>flex-mojos-repository</id>
      <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
    </pluginRepository>
  </pluginRepositories>

</project>

Related Discussion References