隨筆-193  評(píng)論-715  文章-1  trackbacks-0
          ANT提供了對(duì)mxmlc命令的支持,可以直接用來編譯使用Flex為UI的JavaEE應(yīng)用,如果你在Flex中也使用Module來作為你每個(gè)功能的組織形式,你不妨考慮用如下腳本去編譯你的應(yīng)用:
          <target name="compileUI" >
                  
          <echo message="start to compile Flex UI" />
                  
          <for param="file">
                      
          <path>
                          
          <fileset dir="${flexsrc.dir}">
                              
          <include name="**/*.mxml" />
                          
          </fileset>
                      
          </path>
                      
          <sequential>        
                          
          <propertyregex override="yes" property="compile.target.name" input="@{file}" regexp="(.*)src(.*)(mxml)" replace="\1bin\2swf" />
                         
           <mxmlc file="@{file}" output="${compile.target.name}"
                              services
          ="${service.file}" context-root="${context.root}">
                              
          <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
                              
          <static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
                              
          <source-path path-element="${flexsrc.dir}" />
                              
          <!-- use incremental compiling-->
                              
          <compiler.incremental>true</compiler.incremental>
                              
          <compiler.debug>false</compiler.debug>
                              
                              
          <!-- 指定外部依賴庫文件,這些庫文件將不會(huì)編譯進(jìn)目標(biāo)SWF中 -->
                              
          <compiler.external-library-path dir="${flexlib.dir}">
                                  
          <include name="**/*.swc" />
                              
          </compiler.external-library-path>
                          
          </mxmlc>
                          
          <!-- 清除緩存文件 -->
                          
          <!--
                          <delete file="${compile.target.name}.cache" />
                          
          -->
                          
          <echo message="Compiled @{file} =====>>   ${compile.target.name}" />
                          
                      
          </sequential>
                  
          </for>

              
          </target>


          注意事項(xiàng):
          1,必須使用ant-contrib包來支持for任務(wù),使用for任務(wù)時(shí),別忘了如下聲明:
          <path id="ant.classpath">
                  
          <fileset dir="${ant.lib.dir}">
                      
          <include name="*.jar" />
                  
          </fileset>
              
          </path>
              
          <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="ant.classpath" />

          2,編譯每個(gè)mxml時(shí),可用propertyregex來得到output文件名,
          3,source-path一定不能寫錯(cuò),或隨便寫,如果這樣的話,會(huì)出現(xiàn)如下錯(cuò)誤:
                        Error: A file found in a source-path must have the same package structure
          4,如果在運(yùn)行的過程中出現(xiàn)Java heap size或permGen不足的情況,可以指定如下系統(tǒng)參數(shù):
                        ANT_OPTS=-XX:MaxPermSize=256M -Xmx1024m
          posted on 2010-09-26 08:51 Robin's Programming World 閱讀(3166) 評(píng)論(3)  編輯  收藏 所屬分類: JavaFlex & Flash

          評(píng)論:
          # re: 使用ANT批量編譯Flex應(yīng)用和模塊(Use ANT to batch compiling application and modules of Flex) 2010-11-23 16:27 | juni gao
          樓主能不能給一份詳細(xì)的 使用Flex為UI的JavaEE應(yīng)用的build.xml文件,我是菜鳥,剛接觸這個(gè),不是很明白!謝謝您的幫忙,感激不盡!  回復(fù)  更多評(píng)論
            
          # re: 使用ANT批量編譯Flex應(yīng)用和模塊(Use ANT to batch compiling application and modules of Flex) 2012-07-05 10:52 | baiyunping333
          @juni gao
          把a(bǔ)nt當(dāng)什么了  回復(fù)  更多評(píng)論
            
          # re: 使用ANT批量編譯Flex應(yīng)用和模塊(Use ANT to batch compiling application and modules of Flex) 2013-03-11 20:48 | bie520
          <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="ant.classpath" />
          這個(gè)是什么意思  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 禄丰县| 来安县| 洛川县| 修武县| 新泰市| 辽宁省| 台前县| 乌鲁木齐县| 锡林郭勒盟| 德令哈市| 禹城市| 绥芬河市| 习水县| 石泉县| 兴隆县| 岱山县| 洪雅县| 岗巴县| 石楼县| 尤溪县| 武鸣县| 沙坪坝区| 永仁县| 江达县| 托里县| 行唐县| 留坝县| 九龙县| 枣庄市| 珲春市| 浑源县| 乌什县| 浠水县| 大同县| 平远县| 抚顺市| 咸宁市| 温泉县| 建平县| 周口市| 堆龙德庆县|