...

View Full Version : How to make ant build.xml for a working FlashBuilder project?



jctpro
12-15-2011, 07:51 PM
I have a Flex project that uses BlazeDS and I want to make an external build script so I can build the project outside of FlashBuilder. The eclipse environment lets you export an ant build xml file but it only has the java commands. Is there a way to export the mxmlc commands used by FlashBuilder to make an ant build file?

jctpro
12-16-2011, 02:48 PM
Finally got the syntax right. Here is the build file I ended up with:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->

<project basedir="." default="build" name="insDeploy">


<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar"/>


<property name="FLEX_HOME" value="C:\Program Files\Adobe\Adobe Flash Builder 4.5\sdks\4.5.1"/>
<property name="FLEX_APP_ROOT" value="flex_src"/>
<property name="DEPLOY_DIR" value="C:\insWorkspace\insDeploy\WebContent"/>

<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../eclipse"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Web App Libraries.libraryclasspath">
<pathelement location="WebContent/WEB-INF/lib/cfgatewayadapter.jar"/>
<pathelement location="WebContent/WEB-INF/lib/commons-codec-1.3.jar"/>
<pathelement location="WebContent/WEB-INF/lib/commons-httpclient-3.0.1.jar"/>
<pathelement location="WebContent/WEB-INF/lib/commons-logging.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-messaging-common.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-messaging-core.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-messaging-opt.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-messaging-proxy.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-messaging-remoting.jar"/>
<pathelement location="WebContent/WEB-INF/lib/flex-rds-server.jar"/>
<pathelement location="WebContent/WEB-INF/lib/log4j-1.2.16.jar"/>
<pathelement location="WebContent/WEB-INF/lib/xalan.jar"/>
</path>
<path id="EAR Libraries.libraryclasspath"/>
<path id="Apache Tomcat v6.0 [Apache Tomcat v6.0].libraryclasspath">
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/annotations-api.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/catalina-ant.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/catalina-ha.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/catalina-tribes.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/catalina.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/el-api.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/jasper-el.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/jasper-jdt.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/jasper.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/jsp-api.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/mysql-connector-java-5.1.14-bin.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/servlet-api.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/tomcat-coyote.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/tomcat-dbcp.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/tomcat-i18n-es.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/tomcat-i18n-fr.jar"/>
<pathelement location="../../magnan_tomcat/apache-tomcat-6.0.29/lib/tomcat-i18n-ja.jar"/>
</path>
<path id="insDeploy.classpath">
<pathelement location="WebContent/WEB-INF/classes"/>
<path refid="Web App Libraries.libraryclasspath"/>
<path refid="EAR Libraries.libraryclasspath"/>
<pathelement location="../../insDevConfig/insDevLog4j/apache-log4j-1.2.16/apache-log4j-1.2.16/log4j-1.2.16.jar"/>
<path refid="Apache Tomcat v6.0 [Apache Tomcat v6.0].libraryclasspath"/>
</path>
<target name="init">
<mkdir dir="WebContent/WEB-INF/classes"/>
<copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="WebContent/WEB-INF/classes"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="insDeploy.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>

<!--START FLEX COMPILE -->
<target name="flexApp">

<mxmlc file="${FLEX_APP_ROOT}/insDev.mxml"
output="${DEPLOY_DIR}/insDev.swf">
<load-config filename="${basedir}/mycfg.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
</mxmlc>
</target>


</project>

Inigoesdr
12-23-2011, 07:05 PM
Thanks for posting this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum