maven+flexmojos编译swf、swc脚本例子

虽然现在不再用了,也放上来供以后参考。和ant比较,还是倾向于maven,虽然更慢。

主pom.xml,注意其中module定义。

View Code
<?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.baolemon.sangame.client</groupId>

  <artifactId>sangame-client-parent</artifactId>

  <version>1.0-SNAPSHOT</version>

  <packaging>pom</packaging>

  <name>sangame-client-parent</name>



  <properties>

    <!-- Flex SDK versions -->

    <flex-4.0.version>4.0.0.14159</flex-4.0.version>

    <flex-4.1.version>4.1.0.16248</flex-4.1.version>

    <flex-4.5.version>4.5.1.21328</flex-4.5.version>

    <flex-4.6.version>4.6.b.23201</flex-4.6.version>

    <flex.version>${flex-4.6.version}</flex.version>



    <!-- Dependencies versions -->

    <flexunit.version>4.0-rc-1</flexunit.version>



    <!-- Library settings -->

    <flexlib.library.namespace>http://code.google.com/p/flexlib/</flexlib.library.namespace>

    <flexlib.asdoc.windowTitle>flexlib ${project.version} asdoc</flexlib.asdoc.windowTitle>

    <flexlib.asdoc.mainTitle>flexlib ${project.version} API documentation</flexlib.asdoc.mainTitle>

    <flexlib.asdoc.footer>flexlib - ${project.url}</flexlib.asdoc.footer>

    <flexlib.asdoc.leftFramesetWidth>280</flexlib.asdoc.leftFramesetWidth>



    <!-- Miscellaneous settings -->

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>

  

  <prerequisites>

    <maven>3.0.3</maven>

  </prerequisites>

  

  <modules>

    <module>sangame</module>

    <!--

    <module>http://www.cnblogs.com/gear/gear</module>

    -->

  </modules>

  

  <dependencies>

    <dependency>

      <groupId>com.adobe.flex.framework</groupId>

      <artifactId>flex-framework</artifactId>

      <type>pom</type>

    </dependency>

  </dependencies>



  <dependencyManagement>

    <dependencies>

      <dependency>

        <groupId>com.adobe.flex.framework</groupId>

        <artifactId>flex-framework</artifactId>

        <version>${flex.version}</version>

        <type>pom</type>

      </dependency>

      <dependency>

        <groupId>com.adobe.flexunit</groupId>

        <artifactId>flexunit</artifactId>

        <version>${flexunit.version}</version>

        <type>swc</type>

        <scope>test</scope>

      </dependency>

    </dependencies>

  </dependencyManagement>



  <build>

    <sourceDirectory>${project.basedir}/src</sourceDirectory>

    <testSourceDirectory>${project.basedir}/src-test</testSourceDirectory>

    <directory>${project.basedir}/bin</directory>

    <finalName>${project.artifactId}</finalName>

    <pluginManagement>

      <plugins>

        <plugin>

          <groupId>org.sonatype.flexmojos</groupId>

          <artifactId>flexmojos-maven-plugin</artifactId>

          <version>4.2-beta</version>

          <extensions>true</extensions>

          <dependencies>

            <dependency>

              <groupId>com.adobe.flex</groupId>

              <artifactId>compiler</artifactId>

              <version>${flex.version}</version>

              <type>pom</type>

            </dependency>

          </dependencies>

          <configuration>

            <storepass />

            <themes>

              <theme>${settings.localRepository}/com/adobe/flex/framework/framework/${flex.version}/configs_zip/themes/Spark/spark.css</theme>

            </themes>

            <compilerWarnings>

              <warn-array-tostring-changes>false</warn-array-tostring-changes>

              <warn-assignment-within-conditional>true</warn-assignment-within-conditional>

              <warn-bad-array-cast>true</warn-bad-array-cast>

              <warn-bad-bool-assignment>true</warn-bad-bool-assignment>

              <warn-bad-date-cast>true</warn-bad-date-cast>

              <warn-bad-es3-type-method>true</warn-bad-es3-type-method>

              <warn-bad-es3-type-prop>true</warn-bad-es3-type-prop>

              <warn-bad-nan-comparison>true</warn-bad-nan-comparison>

              <warn-bad-null-assignment>true</warn-bad-null-assignment>

              <warn-bad-null-comparison>true</warn-bad-null-comparison>

              <warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>

              <warn-boolean-constructor-with-no-args>false</warn-boolean-constructor-with-no-args>

              <warn-changes-in-resolve>false</warn-changes-in-resolve>

              <warn-class-is-sealed>true</warn-class-is-sealed>

              <warn-const-not-initialized>true</warn-const-not-initialized>

              <warn-constructor-returns-value>false</warn-constructor-returns-value>

              <warn-deprecated-event-handler-error>false</warn-deprecated-event-handler-error>

              <warn-deprecated-function-error>true</warn-deprecated-function-error>

              <warn-deprecated-property-error>true</warn-deprecated-property-error>

              <warn-duplicate-argument-names>true</warn-duplicate-argument-names>

              <warn-duplicate-variable-def>true</warn-duplicate-variable-def>

              <warn-for-var-in-changes>false</warn-for-var-in-changes>

              <warn-import-hides-class>true</warn-import-hides-class>

              <warn-instance-of-changes>true</warn-instance-of-changes>

              <warn-internal-error>true</warn-internal-error>

              <warn-level-not-supported>true</warn-level-not-supported>

              <warn-missing-namespace-decl>true</warn-missing-namespace-decl>

              <warn-negative-uint-literal>true</warn-negative-uint-literal>

              <warn-no-constructor>false</warn-no-constructor>

              <warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>

              <warn-no-type-decl>true</warn-no-type-decl>

              <warn-number-from-string-changes>false</warn-number-from-string-changes>

              <warn-scoping-change-in-this>false</warn-scoping-change-in-this>

              <warn-slow-text-field-addition>true</warn-slow-text-field-addition>

              <warn-unlikely-function-value>true</warn-unlikely-function-value>

              <warn-xml-class-has-changed>false</warn-xml-class-has-changed>

            </compilerWarnings>

            <optimize>true</optimize>

            <keepAs3Metadatas>

              <keepAs3Metadata>Bindable</keepAs3Metadata>

              <keepAs3Metadata>Managed</keepAs3Metadata>

              <keepAs3Metadata>ChangeEvent</keepAs3Metadata>

              <keepAs3Metadata>NonCommittingChangeEvent</keepAs3Metadata>

              <keepAs3Metadata>Transient</keepAs3Metadata>

            </keepAs3Metadatas>

          </configuration>

        </plugin>

      </plugins>

    </pluginManagement>

  </build>

</project>

每个module的例子

View Code
<?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>



  <parent>

    <groupId>com.baolemon.sangame.client</groupId>

    <artifactId>sangame-client-parent</artifactId>

    <version>1.0-SNAPSHOT</version>

  </parent>

  

  <groupId>com.baolemon.sangame.client</groupId>

  <artifactId>sangame-client</artifactId>

  <version>1.0-SNAPSHOT</version>

  <packaging>swf</packaging>

  <name>sangame-client</name>



  <dependencies>

    <dependency>

      <groupId>com.baolemon.sangame.client</groupId>

      <artifactId>gear-framework</artifactId>

      <version>1.0.3-SNAPSHOT</version>

      <type>swc</type>

    </dependency>

  </dependencies>



  <build>

    <plugins>

      <plugin>

        <groupId>org.sonatype.flexmojos</groupId>

        <artifactId>flexmojos-maven-plugin</artifactId>

        <extensions>true</extensions>

        <configuration>

          <sourceFile>${project.build.sourceDirectory}/sangame/test/PVETest.as</sourceFile>

          <storepass />

        </configuration>

      </plugin>

    </plugins>

  </build>



</project>

如果编译的是swc,脚本为(其实只是packing不同而已)

View Code
<?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>



  <parent>

    <groupId>com.baolemon.sangame.client.tools</groupId>

    <artifactId>client-tools-parent</artifactId>

    <version>1.0-SNAPSHOT</version>

  </parent>

  <artifactId>tools-httpServer</artifactId>

  <version>1.0-SNAPSHOT</version>

  <packaging>swc</packaging>



  <name>tools-httpServer</name>

  <build>

    <plugins>

      <plugin>

        <groupId>org.sonatype.flexmojos</groupId>

        <artifactId>flexmojos-maven-plugin</artifactId>

        <extensions>true</extensions>

        <configuration>

          <storepass />

        </configuration>

      </plugin>

    </plugins>

  </build>



</project>

 

你可能感兴趣的:(maven)