Index: trunk/gsdl3/build.xml
===================================================================
--- trunk/gsdl3/build.xml	(revision 13921)
+++ trunk/gsdl3/build.xml	(revision 13925)
@@ -397,36 +397,25 @@
  <!-- ========== Web app Targets ================================ -->
   
-  <target name="prepare-web" depends="init">
+  <target name="prepare-web" depends="init,configure-java-version">
     <mkdir dir="${web.home}/applet"/>
     <mkdir dir="${web.home}/logs"/>
-    <condition property="need.xml.jars">
+  </target>
+  
+  <!-- if we are using java 1.5, we need the xalan.jar file in web/WEB-INF/lib,  but if we are using java 1.4, we can't have it there -->
+  <target name="configure-java-version" depends="init"
+    description="Run this target if you have changed the default version of java since installing greenstone3">
+    <condition property="need.xalan.jar">
       <equals arg1="1.5" arg2="${ant.java.version}"/>
     </condition>
-    <antcall target="activate-xml-jars"/>
-    <antcall target="deactivate-xml-jars"/>
-  </target>
-  
-  <target name="configure-java-version" depends="init"
-    description="Run this target if you have changed the default version of java since installing greenstone3">
-    <condition property="need.xml.jars">
-      <equals arg1="1.5" arg2="${ant.java.version}"/>
-    </condition>
-    <antcall target="activate-xml-jars"/>
-    <antcall target="deactivate-xml-jars"/>
-    <condition property="need.tomcat.compat">
-      <equals arg1="1.5" arg2="${ant.java.version}"/>
-    </condition>
-    <antcall target="install-tomcat-compat"/>
-    <antcall target="uninstall-tomcat-compat"/>
-  </target>
-  
-  <target name="activate-xml-jars" if="need.xml.jars">
+    <antcall target="activate-xalan-jar"/>
+    <antcall target="deactivate-xalan-jar"/>
+  </target>
+  
+  <target name="activate-xalan-jar" if="need.xalan.jar">
     <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
-    <copy file="${web.lib}/xercesImpl.jar.tmp" tofile="${web.lib}/xercesImpl.jar"/>
-  </target>
-  
-  <target name="deactivate-xml-jars" unless="need.xml.jars">
+  </target>
+  
+  <target name="deactivate-xalan-jar" unless="need.xalan.jar">
     <delete file="${web.lib}/xalan.jar"/>
-    <delete file="${web.lib}/xercesImpl.jar"/>
   </target>
 
@@ -498,13 +487,8 @@
 <!-- ======================= Tomcat Targets ========================== -->
   
-  <!-- this target sets up tomcat for the first time, or resets it any subsequent times -->
-  <target name="prepare-tomcat" depends="init,download-tomcat" if="tomcat.islocal">
-    <condition property="need.tomcat.compat">
-      <equals arg1="1.4" arg2="${ant.java.version}"/>
-    </condition>
-    <antcall target="install-tomcat-compat"/>
-  </target>
-
-  <target name="download-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
+  <!-- this target downloads and installs Tomcat -->
+  <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
+  <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
+
     <!-- check that packages dir is there -->
     <mkdir dir="${packages.home}"/>
@@ -512,10 +496,13 @@
       dest="${packages.home}/apache-tomcat-5.5.12.zip"
       usetimestamp="true"/>
-    <delete dir="${packages.home}/tomcat.bak"/>
-    <move todir="${packages.home}/tomcat.bak" failonerror="false">
-      <fileset dir="${packages.home}/tomcat"/>
-    </move>
     <unzip src="${packages.home}/apache-tomcat-5.5.12.zip" 
       dest="${packages.home}"/>
+    <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12-compat.zip"
+      dest="${packages.home}/apache-tomcat-5.5.12-compat.zip"
+      usetimestamp="true"/>
+    <unzip src="${packages.home}/apache-tomcat-5.5.12-compat.zip" 
+      dest="${packages.home}"/>
+    <!-- delete any existing tomcat -->
+    <delete dir="${packages.home}/tomcat"/>
     <move todir="${packages.home}/tomcat">
       <fileset dir="${packages.home}/apache-tomcat-5.5.12"/>
@@ -529,36 +516,5 @@
     <!-- make sure we have execute permission for the .sh files -->
     <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx" 
-      includes="*.sh"/>
-    
-    <!-- download the compat module but don't install it unless necessary -->
-    <get src="http://www.greenstone.org/gs3files/apache-tomcat-5.5.12-compat.zip"
-      dest="${packages.home}/apache-tomcat-5.5.12-compat.zip"
-      usetimestamp="true"/>
-    <unzip src="${packages.home}/apache-tomcat-5.5.12-compat.zip" 
-      dest="${packages.home}"/>
-    <move todir="${packages.home}/tomcat-compat">
-      <fileset dir="${packages.home}/apache-tomcat-5.5.12"/>
-    </move>
-  </target>
-
-  
-  <target name="install-tomcat-compat" if="need.tomcat.compat">
-    <copy file="${packages.home}/tomcat-compat/common/endorsed/xml-apis.jar"
-      tofile="${web.applet}/xml-apis.jar"/>
-    <copy file="${packages.home}/tomcat-compat/common/endorsed/xml-apis.jar"
-      tofile="${packages.home}/tomcat/common/endorsed/xml-apis.jar"/>    
-    <copy file="${packages.home}/tomcat-compat/common/endorsed/xercesImpl.jar"
-      tofile="${web.applet}/xercesImpl.jar"/>
-    <copy file="${packages.home}/tomcat-compat/common/endorsed/xercesImpl.jar"
-      tofile="${packages.home}/tomcat/common/endorsed/xercesImpl.jar"/>
-    <copy file="${packages.home}/tomcat-compat/bin/jmx.jar"
-      tofile="${packages.home}/tomcat/bin/jmx.jar"/>
-  </target>
-  <target name="uninstall-tomcat-compat" unless="need.tomcat.compat">
-    <delete file="${web.applet}/xml-apis.jar"/>
-    <delete file="${packages.home}/tomcat/common/endorsed/xml-apis.jar"/>    
-    <delete file="${web.applet}/xercesImpl.jar"/>
-    <delete file="${packages.home}/tomcat/common/endorsed/xercesImpl.jar"/>
-    <delete file="${packages.home}/tomcat/bin/jmx.jar"/>
+      includes="*.sh"/>   
   </target>
   
@@ -585,11 +541,5 @@
     <!-- need to edit the config file, or do we get the user to do this???-->
   </target>
-  
-  <target name="reload" description="Reload web application"
-          depends="init,setup-catalina-ant-tasks">
-    <reload  url="http://${tomcat.server}:${tomcat.port}/manager" username="admin" password="admin"
-            path="${app.path}"/>
-  </target>
-  
+    
   <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
    <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
@@ -844,4 +794,5 @@
       </manifest>
     </jar>
+    <mkdir dir="${web.applet}"/>
     <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
     <jar destfile="${build.home}/anttasks.jar">
