隨筆-193  評論-715  文章-1  trackbacks-0
          ANT提供了對mxmlc命令的支持,可以直接用來編譯使用Flex為UI的JavaEE應用,如果你在Flex中也使用Module來作為你每個功能的組織形式,你不妨考慮用如下腳本去編譯你的應用:
          <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>
                              
                              
          <!-- 指定外部依賴庫文件,這些庫文件將不會編譯進目標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>


          注意事項:
          1,必須使用ant-contrib包來支持for任務,使用for任務時,別忘了如下聲明:
          <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,編譯每個mxml時,可用propertyregex來得到output文件名,
          3,source-path一定不能寫錯,或隨便寫,如果這樣的話,會出現如下錯誤:
                        Error: A file found in a source-path must have the same package structure
          4,如果在運行的過程中出現Java heap size或permGen不足的情況,可以指定如下系統參數:
                        ANT_OPTS=-XX:MaxPermSize=256M -Xmx1024m
          posted on 2010-09-26 08:51 Robin's Programming World 閱讀(3160) 評論(3)  編輯  收藏 所屬分類: JavaFlex & Flash

          評論:
          # re: 使用ANT批量編譯Flex應用和模塊(Use ANT to batch compiling application and modules of Flex) 2010-11-23 16:27 | juni gao
          樓主能不能給一份詳細的 使用Flex為UI的JavaEE應用的build.xml文件,我是菜鳥,剛接觸這個,不是很明白!謝謝您的幫忙,感激不盡!  回復  更多評論
            
          # re: 使用ANT批量編譯Flex應用和模塊(Use ANT to batch compiling application and modules of Flex) 2012-07-05 10:52 | baiyunping333
          @juni gao
          把ant當什么了  回復  更多評論
            
          # re: 使用ANT批量編譯Flex應用和模塊(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" />
          這個是什么意思  回復  更多評論
            
          主站蜘蛛池模板: 南川市| 广河县| 彰武县| 青河县| 静安区| 宜兰市| 苏州市| 西藏| 怀化市| 泸西县| 体育| 南开区| 孝感市| 屯昌县| 丽江市| 迭部县| 广灵县| 松桃| 方山县| 英超| 恭城| 壤塘县| 定远县| 兴城市| 加查县| 丹寨县| 济宁市| 阜阳市| 绿春县| 宁都县| 泸水县| 沂水县| 安顺市| 石景山区| 农安县| 寻乌县| 衡阳县| 仁怀市| 独山县| 青铜峡市| 东乡县|