Index: gs3-extensions/mat/trunk/build.xml
===================================================================
--- gs3-extensions/mat/trunk/build.xml	(revision 22001)
+++ gs3-extensions/mat/trunk/build.xml	(revision 22017)
@@ -1,31 +1,38 @@
 <project name="Mat" basedir="." default="main">
   <property environment="env"/>
-  <property name="gsdl3srchome.dir" value="${env.GSDL3SRCHOME}"/>
+  <property name="gsdl3srchome" value="${env.GSDL3SRCHOME}"/>
 
-  <property name="scripts.dir" value="bin/script"/>
-  <property name="mat.scripts.dir" value="web/script"/>
-  <property name="src.dir"     value="src"/>
-  <property name="build.dir"   value="build"/>
-  <property name="classes.dir" value="${build.dir}/classes"/>
-  <property name="lib.dir"     value="lib"/>
-  <property name="tmp.dir"     value="tmp"/>
-  <property name="web.dir" value="${gsdl3srchome.dir}/web/WEB-INF"/>
-  <property name="web.lib.dir" value="${web.dir}/lib"/>
-  <property name="web.classes.dir" value="${web.dir}/classes"/>
-  <property name="jcommon" value="jcommon.jar"/>
-  <property name="jfreechart" value="jfreechart.jar"/>
-  <property name="jni.dir" value="${gsdl3srchome.dir}/lib/jni"/>	
-  <property name="tomcat.home" value="${gsdl3srchome.dir}/packages/tomcat"/>
-  <property name="tomcat.lib.dir" value="${tomcat.home}/lib"/>
-  <property name="web.lib.dir" value="${web.dir}/lib"/>
-  <property name="web.class.dir" value="${web.dir}/classes/org/greenstone/mat/servlet"/>
-  <property name="mat.class.dir" value="${classes.dir}/org/greenstone/mat/servlet"/>
-  <property name="mat.classes.dir" value="web/WEB-INF/classes"/>
+  <property name="mat.web" value="web"/>
+  <property name="mat.bin.scripts" value="bin/script"/>
+  <property name="mat.web.scripts" value="${mat.web}/script"/>
+  <property name="mat.src"     value="src"/>
+  <property name="mat.build"   value="build"/>
+  <property name="mat.classes.base" value="${mat.build}/org/greenstone"/>
+  <property name="mat.admin.classes" value="${mat.classes.base}/admin"/>
+  <property name="mat.main.classes" value="${mat.classes.base}/mat"/>
+  <property name="mat.classes" value="${mat.build}/classes"/>
+  <property name="mat.lib"     value="lib"/>
+  <property name="mat.tmp"     value="tmp"/>
+  <property name="mat.resources" value="resources"/>
+  <property name="mat.tomcat.resources" value="${mat.resources}/tomcat"/>
+  <property name="mat.script.resources" value="${mat.resources}/script"/>
+  <property name="mat.webinf" value="${mat.web}/WEB-INF"/>
+  <property name="mat.webinf.lib" value="${mat.webinf}/lib"/>
+  <property name="mat.webinf.classes" value="${mat.webinf}/classes"/>
+
+  <property name="gs.jni" value="${gsdl3srchome}/lib/jni"/>	
+  <property name="gs.webinf" value="${gsdl3srchome}/web/WEB-INF"/>
+  <property name="gs.webinf.lib" value="${gs.webinf}/lib"/>
+  <property name="gs.webinf.classes" value="${gs.webinf}/classes"/>
+
+  <property name="tomcat" value="${gsdl3srchome}/packages/tomcat"/>
+  <property name="tomcat.lib" value="${tomcat}/lib"/>
+  <property name="tomcat.localhost" value="${tomcat}/conf/Catalina/localhost"/>
   
   <path id="classpath">
-    <fileset dir="${lib.dir}">
+    <fileset dir="${mat.lib}">
       <include name="**/*.jar"/>
     </fileset>
-    <dirset  dir="${lib.dir}">
+    <dirset  dir="${mat.lib}">
       <include name="**/classes"/>
     </dirset>
@@ -37,38 +44,28 @@
   
   <target name="clean">
-    <delete dir="${build.dir}"/>
-    <delete dir="${lib.dir}"/>
+    <delete dir="${mat.build}"/>
+    <delete dir="${mat.lib}"/>
   </target>
   
   <target name="compile" depends="setup-java-lib,setup-tmp,create_log_folder,move-mat-xml">
-    <mkdir dir="${classes.dir}"/>
-    <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
+    <mkdir dir="${mat.classes}"/>
+    <javac srcdir="${mat.src}" destdir="${mat.classes}" classpathref="classpath"/>
     
-    <mkdir dir="${web.class.dir}"/>
-    <copy todir="${web.class.dir}">
-      <fileset dir="${mat.class.dir}">
-      	<include name="**/*.class"/>
-      </fileset>
+    <copy file="${gs.webinf.classes}/global.properties" tofile="${mat.webinf.classes}/global.properties"/>
+
+    <mkdir dir="${mat.web.scripts}"/>
+    <copy todir="${mat.web.scripts}">
+      <fileset dir="${mat.bin.scripts}"/>
     </copy>
 
-    <copy file="${web.classes.dir}/global.properties" tofile="${mat.classes.dir}/global.properties"/>
-    <copy file="${web.classes.dir}/log4j.properties" tofile="${mat.classes.dir}/log4j.properties"/>
+    <jar destfile="${mat.webinf.lib}/mat.jar">
+      <fileset dir=".">
+	<include name="${mat.main.classes}/**"/>
+      </fileset>
+    </jar>
 
-    <mkdir dir="${mat.scripts.dir}"/>
-    <copy todir="${mat.scripts.dir}">
-      <fileset dir="${scripts.dir}"/>
-    </copy>
-
-    <jar destfile="web/WEB-INF/lib/mat.jar">
-      <fileset dir="build/classes">
-	<include name="org/greenstone/mat/**"/>
-      </fileset>
-      <manifest>
-	<attribute name="Class-Path" value="${web.lib.dir}/gsdl3.jar ${jni.dir}/mg.jar ${jni.dir}/mgpp.jar ${web.lib.dir}/log4j-1.2.8.jar ${web.lib.dir}/activation.jar ${web.lib.dir}/mail.jar"/>
-      </manifest>
-    </jar>
     <jar destfile="guiext.jar">
-      <fileset dir="build/classes">
-	<include name="org/greenstone/admin/**"/>
+      <fileset dir=".">
+	<include name="${mat.admin.classes}/**"/>
       </fileset>
     </jar>
@@ -76,5 +73,5 @@
   
   <target name="move-mat-xml">
-    <copy file="${basedir}/resources/tomcat/mat.xml" tofile="${tomcat.home}/conf/Catalina/localhost/mat.xml" overwrite="true">
+    <copy file="${mat.tomcat.resources}/mat.xml" tofile="${tomcat.localhost}/mat.xml" overwrite="true">
       <filterset>
         <filter token="matwebhome" value="${basedir}/web"/>
@@ -84,50 +81,57 @@
   
   <target name="setup-java-lib">
-    
-    <mkdir dir="${lib.dir}"/>
-    <copy todir="${lib.dir}">
-      <fileset dir="${web.dir}/lib">
+
+    <mkdir dir="${mat.lib}"/>
+    <copy todir="${mat.lib}">
+      <fileset dir="${gs.webinf.lib}">
       	<include name="**/*.jar"/>
       </fileset>
     </copy>
     
-    <mkdir dir="${lib.dir}/classes"/>
-    <copy todir="${lib.dir}/classes">
-      <fileset dir="${web.dir}/classes"/>
+    <mkdir dir="${mat.lib}"/>
+    <copy todir="${mat.lib}">
+      <fileset dir="${gs.webinf.classes}"/>
     </copy>
     
-    <copy todir="${lib.dir}">
-      <fileset dir="${jni.dir}">
+    <copy todir="${mat.lib}">
+      <fileset dir="${gs.jni}">
       	<include name="**/*.jar"/>
       </fileset>
     </copy>	
     
-    <copy todir="${lib.dir}">
-      <fileset dir="${tomcat.lib.dir}">
+    <copy todir="${mat.lib}">
+      <fileset dir="${tomcat.lib}">
       	<include name="**/servlet-api.jar"/>
       </fileset>
     </copy>	
     
-    <copy todir="${lib.dir}">
-      <fileset dir="${web.lib.dir}">
+<!--    <copy todir="${mat.lib}">
+      <fileset dir="${gs.webinf.lib}">
       	<include name="xml-apis.jar"/>
       </fileset>
-    </copy>	
+    </copy> -->	
     
-    <copy todir="${lib.dir}">
+    <copy todir="${mat.lib}">
       <fileset dir="./">
-      	<include name="${jcommon}"/>
-	<include name="${jfreechart}"/>
+      	<include name="jcommon.jar"/>
+	<include name="jfreechart.jar"/>
+      </fileset>
+    </copy>
+
+    <mkdir dir="${mat.webinf.lib}"/>
+    <copy todir="${mat.webinf.lib}">
+      <fileset dir="${mat.lib}">
+      	<include name="**"/>
       </fileset>
     </copy>
     
-    <mkdir dir="${mat.scripts.dir}"/>
-    <copy todir="${mat.scripts.dir}/script">
-      <fileset dir="resources/script"/>
+    <mkdir dir="${mat.web.scripts}"/>
+    <copy todir="${mat.web.scripts}">
+      <fileset dir="${mat.script.resources}"/>
     </copy>	
   </target>
   
   <target name ="clean-tmp">
-    <delete dir="${tmp.dir}"/>
+    <delete dir="${mat.tmp}"/>
     <echo> ${tmp.dir} has been removed </echo>
   </target>
@@ -135,5 +139,5 @@
     <mkdir dir="./tmp"/>
     <echo> ${tmp.dir} has been created </echo>
-    <echo file="${tmp.dir}/log.txt">This is the log file.</echo>
+    <echo file="${mat.tmp}/log.txt">This is the log file.</echo>
   </target>
   <target name="clean-compile" depends="clean,compile"/>
