隨筆-193  評(píng)論-715  文章-1  trackbacks-0
          ANT提供了對(duì)mxmlc命令的支持,可以直接用來(lái)編譯使用Flex為UI的JavaEE應(yīng)用,如果你在Flex中也使用Module來(lái)作為你每個(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>
                              
                              
          <!-- 指定外部依賴庫(kù)文件,這些庫(kù)文件將不會(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包來(lái)支持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來(lái)得到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 閱讀(3160) 評(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)論
            
          主站蜘蛛池模板: 武山县| 丹东市| 玛沁县| 建昌县| 泌阳县| 常宁市| 瑞金市| 海盐县| 伊宁县| 福建省| 马山县| 日喀则市| 梁平县| 宽甸| 锡林浩特市| 乐昌市| 天柱县| 阳东县| 瑞金市| 新绛县| 图木舒克市| 鞍山市| 棋牌| 永年县| 普定县| 施秉县| 瑞安市| 平湖市| 武山县| 揭阳市| 武安市| 赣州市| 海淀区| 池州市| 兰州市| 镇康县| 芒康县| 青岛市| 青阳县| 阜阳市| 奉节县|