Flex Mobile Maven Build

时间:2011-07-13 10:54:21

标签: android ios flex maven flex-mobile

我试图找出是否有办法使用maven构建我的flex移动项目。

当我运行我的maven构建时,我想要一个apk文件和一个ipa文件作为构建过程的输出。如果有办法运行单元测试,那真的很酷。

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

有什么建议吗?

3 个答案:

答案 0 :(得分: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 :(得分:3)

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

答案 2 :(得分:1)

我也需要它......

我做了一些googleing ...这是我发现的纯maven解决方案..,到目前为止,看到这篇博文,我试过,它的工作原理 http://www.flexthinker.com/2011/07/how-to-build-a-flex-mobile-app-with-maven/

但是,它是付费版本,没有官方发布......

也许我会使用纯蚂蚁,而不是花哨但更有效率