在Flex项目中使用Maven之FlexMojo

来源:互联网 发布:王逗逗淘宝店铺号 编辑:程序博客网 时间:2024/05/22 01:35

http://www.riameeting.com/node/453

 

 

1.Creating a Flex Mojos Project from an Archetype

以下命令使用的flex-mojos版本为3.5

 

flexmojos-archetypes-library

Creates a simple Flex Library project which produces a SWC

flexmojos-archetypes-application

Creates a simple Flex Application with produces a SWF

flexmojos-archetypes-modular-webapp

Creates a Multimodule project which consists of a project that produces a SWC which is consumed by a project which produces a SWF that is ultimately presented in a project that generates a WAR

 

 

 

2.指定flash player版本

第一步:

<plugins>
      <plugin>

     省略----

    <!--添加的部分-->
  <configuration>  
                  <targetPlayer>10.0.0</targetPlayer>   <!-- 指定Flash Player版本 --> 

 </configuration>   

        省略----

第二部:指定com.adobe.flex.framework.playerglobal 版本

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

第三部:取消默认设置,flex3指定的默认设置为flash player9

 <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>

完整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.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>

 

原创粉丝点击