Robert,
Thanks for responding. Here is my Ant script, comments and all.
Jerry
=======================
<?xml version="1.0" ?>
<project default="main" >
<!-- basedir. Hmm. we could actually put this Ant script IN THE ROOT of the sbda eclipse project, as it is mapped to svn.
Then we could have a separate script that checks out all of that stuff from svn, cd's to the root of the checked out
code, then runs Ant. In that case the basedir IS ".", because it is all run relative to wherever that checked out
code will lives. This also gets this script into ANT, which is a safe place for it.
So where does the 'first' script live? We have to use it before we check out from svn...
And what about the php code to handle uploads, sb_upload.php? For now that is separate, not directly in svn.
At least until we can get the eclipse for php to also use Subclipse.
Note: we also need to do a plain vanilla copy of the WEB-INF from basedir to the war dir. We do NOT wish
to create the WEB-INF from scratch!!
-->
<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"> </taskdef>
<target name="main" depends="checkout, initvars, initdirs, compile, war, deploy"/>
<target name="mainxxxx" depends="initvars, compile"/>
<property name="checkout_target" value="C:\dev\sb\BuildScience\ant_dev\root3"/>
<property name="checkedout_project" value="${checkout_target}"/>
<target name="checkout" >
<svn javahl="true" description="use svn-ant to checkout from our svn -- destPath is 'basedir' for all else">
<checkout url="http://sb001.com/dev/sbda"
destPath="${checkout_target}"/>
</svn>
</target>
<target name="initvars">
<property name="src" value="${checkedout_project}/src"/> <!-- this works! -->
<property name="bin" value="${checkedout_project}/output"/> <!-- this works! First we compile to 'bin', then later copy to WEB-INF/classes. Yes.-->
<property name="web" value="${checkedout_project}\WebContent"/> <!-- this works! Because all of the webby stuff (in our case the mxml and as in their folders) IS at basedir-->
<property name="descriptors"
value="${checkedout_project}/output/deploymentdescriptors"/>
<property name="wardir" value="${checkedout_project}/output/war"/>
<property name="warfile" value="sbda.war"/>
<property name="warfinaldir" value="${checkedout_project}/finalwar"/>
<property name="deploydir" value="${checkedout_project}/fakojbossdeploydir"/>
<property name="morejarsdir" value="${web}\WEB-INF\lib"/>
<property name="morejarsdir2" value="${web}\WEB-INF\flex\jars"/>
<echo> "checkout_target is: ${checkout_target}" </echo>
<echo> "checkedout_project is: ${checkedout_project}" </echo>
<echo> "src is: ${src}" </echo>
<echo> "bin is: ${bin}" </echo>
<echo> "web is: ${web}" </echo>
<echo> "descriptors is: ${descriptors}" </echo>
<echo> "wardir is: ${wardir}" </echo>
<echo> "warfile is: ${warfile}" </echo>
<echo> "warfinaldir is: ${warfinaldir}" </echo>
<echo> "deploydir is: ${deploydir}" </echo>
<echo> "morejarsdir is: ${morejarsdir}" </echo>
<echo> "morejarsdir2 is: ${morejarsdir2}" </echo>
<!--
<path id="classpath">
<fileset dir="${morejarsdir}" includes="**/*.jar"/>
<fileset dir="${morejarsdir2}" includes="**/*.jar"/>
</path>
-->
</target>
<target name="initdirs">
<!-- <mkdir dir="${wardir}/WEB-INF"/> MUST do a straight copy of this from basedir. Do NOT create from scratch.-->
<mkdir dir="${wardir}/WEB-INF/classes"/> <!-- But this one is a keeper, since our WEB-INF does NOT have a classes directory. -->
<!-- A new directory: a place to put the finished WAR file -->
<mkdir dir="${warfinaldir}" />
<mkdir dir="${deploydir}" />
</target>
<!-- Looks good. Will compile from 'src' and place the results in 'bin', which is /output. The war target will copy them from there to the appropriate place in the WAR file.
Damn. javac cannot find our classpath lib. It should be able to figure out the Postgres and Flex stuff but it does not yet. This classpath ref is the likeliest culprit.
-->
<!-- <target name="compile">
<javac destdir="${bin}" srcdir="${src}" includes="**/*.java" classpathref="classpath" verbose="true" />
</target> -->
<target name="compile">
<javac destdir="${bin}" srcdir="${src}" includes="**/*.java" verbose="true" >
<classpath>
<fileset dir="${morejarsdir}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${morejarsdir2}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<!-- <classpath refid="build.classpath" /> -->
</target>
<target name="war">
<!-- This big copy will also copy all of the supporting flex stuff we need, especially the stuff in WEB-INF/flex (in svn) -->
<copy todir="${wardir}">
<fileset dir="${web}" >
<include name="**/*.*" />
<exclude name="**/junit.jar" />
<exclude name="**/javax.servlet.jar" />
<exclude name="**/commons-logging.jar" />
<!-- <exclude name="**/postgresql-8.1-410.jdbc3.jar" /> -->
<!--
-->
</fileset>
<!-- postgresql-8.1-410.jdbc3.jar junit.jar javax.servlet.jar -->
</copy>
<!-- <copy file="${descriptors}/web.xml" todir="${wardir}/WEB-INF" /> Don't need this because the web.xml file will be capied by the previous copy step.-->
<!-- Copy the class files to the special location in the war file -->
<copy todir="${wardir}/WEB-INF/classes">
<fileset dir="${bin}" includes="**/*.class" />
<fileset dir="${src}" >
<!--<include name="**/*.java"/> -->
<!-- Very special inclusion: This line will pull in commons-logging.properties from the root of 'src' dir
We absolutely MUST have it to fix Adobe FDS bug 179227 which will otherwise cause the war to fail in JBoss with an error like:
"Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed."
In fact we don't need the Java files but we need this!
-->
<include name="**/*.properties"/>
</fileset>
</copy>
<!-- war it up: -->
<jar jarfile="${warfinaldir}/${warfile}" basedir="${wardir}" />
</target>
<target name="deploy">
<copy file="${warfinaldir}/${warfile}" todir="${deploydir}" />
</target>
<!-- <target name="ear">
<copy file="${descriptors}/application.xml" todir="${eardir}/META-INF" />
<jar jarfile="${basedir}/${earfile}" basedir="${eardir}" />
</target>
-->
</project>