2011-07-13 32 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插件。