2011-07-13 76 views
2

我想知道是否有任何方法可以使用maven构建我的Flex移动项目。Flex Mobile Maven Build

当我运行我的maven构建时,我希望有一个apk文件和一个ipa文件作为构建过程的输出。如果还有一种方法来运行单元测试,那将是非常酷的。

我想要的是一个解决方案,教程或如何处理的例子。

有什么建议吗?

回答

4

Flex Mojos是使用Maven构建Flex应用程序的事实标准。据我所知,它目前不支持移动版本。

如果您有使用Ant的经验,您可以编写一个基于Ant的构建,并使用Maven AntRun插件将目标的执行绑定到Maven阶段。下面是做这行干净的例子,编译,测试和封装:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.6</version> 
      <executions> 
       <execution> 
        <id>clean-project</id> 
        <phase>clean</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <tasks> 
          <ant antfile="${basedir}/build/build.xml"> 
           <target name="clean"/> 
          </ant> 
         </tasks> 
        </configuration> 
       </execution> 
       <execution> 
        <id>create-swf</id> 
        <phase>compile</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <tasks unless="flex.skip"> 
          <ant antfile="${basedir}/build/build.xml"> 
           <target name="compile"/> 
          </ant> 
         </tasks> 
        </configuration> 
       </execution> 
       <execution> 
        <id>flexunit-tests</id> 
        <phase>test</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <tasks unless="maven.test.skip"> 
          <ant antfile="${basedir}/build/build.xml"> 
           <target name="test"/> 
          </ant> 
         </tasks> 
        </configuration> 
       </execution> 
       <execution> 
        <id>generate-asdoc</id> 
        <phase>package</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <tasks unless="asdoc.skip"> 
          <ant antfile="${basedir}/build/build.xml"> 
           <target name="asdoc"/> 
          </ant> 
         </tasks> 
        </configuration> 
       </execution> 
       <execution> 
        <id>dist</id> 
        <phase>package</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <tasks> 
          <ant antfile="${basedir}/build/build.xml"> 
           <target name="dist"/> 
          </ant> 
         </tasks> 
        </configuration> 
       </execution> 
      </executions> 
      <dependencies> 
       <!-- 
        since we are using maven-antrun 1.6 which depends on ant 1.8.1 
        make sure the version number on ant-junit matches 
       --> 
       <dependency> 
        <groupId>org.apache.ant</groupId> 
        <artifactId>ant-junit</artifactId> 
        <version>1.8.1</version> 
       </dependency> 
      </dependencies> 
     </plugin> 
    </plugins> 
</build> 
+1

作为一个额外的补充,我已经[在手机上发布了关于Flex的博客](http://www.michelboudreau.com/2010/08/15/flex-on-android/),并使用Ant构建来编译/打包/部署。你应该看看这个项目,并在Maven构建中使用Ant脚本来完成你需要的一切。 –

3

我知道的大多数人都使用Flex Mojos项目。据我了解,这是一组适用于Flex开发人员的Maven插件。