Index: gs3-extensions/solr/trunk/src/build.xml
===================================================================
--- gs3-extensions/solr/trunk/src/build.xml	(revision 32378)
+++ gs3-extensions/solr/trunk/src/build.xml	(revision 32380)
@@ -4,4 +4,5 @@
   <!-- DIRECTORY LOCATIONS -->
   <!-- local ext paths -->
+  <loadproperties prefix="gs3." srcFile="${basedir}/../../build.properties"/> 
   <property name="src.home" value="${basedir}/src/java"/>
   <property name="build.home" value="${basedir}/build"/>
@@ -17,8 +18,24 @@
   <property name="web.extdir" value="${web.home}/ext/solr"/>
 
-  <property name="tomcat.dir" location="${basedir}/../../packages/tomcat"/> <!-- location property creates an absolute path -->
+  <condition property="tomcat.dir" value="${gs3.tomcat.installed.path}" else="${basedir}/../../packages/tomcat">
+    <and>
+      <isset property="gs3.tomcat.installed.path"/>
+      <not>
+        <equals arg1="${gs3.tomcat.installed.path}" arg2=""/>
+      </not>
+    </and>
+  </condition>
+  <condition property="solr.context" value="${gs3.solr.context}" else="solr">
+    <and>
+      <isset property="gs3.solr.context"/>
+      <not>
+        <equals arg1="${gs3.solr.context}" arg2=""/>
+      </not>
+    </and>
+  </condition>
   <property name="tomcat.lib.dir" value="${tomcat.dir}/lib"/>
   <property name="tomcat.context.dir" value="${tomcat.dir}/conf/Catalina/localhost"/>
-
+	
+		
   <path id="compile.classpath">
     <!-- gs3 jar files we need -->
@@ -112,5 +129,5 @@
     value="GS2SolrSearch.properties"/> --> 
 
-			
+
   <!-- TARGETS -->
   <target name="usage" description="Print a help message">
@@ -196,11 +213,4 @@
   <target name="solr-for-tomcat" description="Helper-target: setting up solr to work tomcat">
     
-    <echo>Copying solr jars needed for running solr with tomcat: ${basedir}/lib/ext</echo>	
-    <copy todir="${tomcat.lib.dir}">	  
-      <fileset dir="lib/ext">
-	<include name="*.jar"/>
-      </fileset>
-    </copy>
-    
     <!-- slf4j and commons logging bridge needed to avoid exception about incompatibility in tomcat log files-->
     <echo>Copying ${basedir}/lib/ext/jcl-over-slf4j-1.6.6.jar again to ${web.libdir}</echo>
@@ -208,17 +218,15 @@
       <filelist id="logging-bridge" dir="lib/ext" files="jcl-over-slf4j-1.6.6.jar"/>
     </copy>
+	
+  	<echo>Upddating xalan related jar files, morphology and gs3-solrserver jars from ${web.libdir} in solr.war</echo>
+	<war destfile="webapps/solr.war" update="true" >
+ 		<zipfileset dir="lib/russianmorphology" includes="*.jar" prefix="WEB-INF/lib"/>
+		<zipfileset dir="lib/ext" includes="*.jar" prefix="WEB-INF/lib"/>
+		<zipfileset dir="${web.libdir}" includes="${shared-xalan-jars}" prefix="WEB-INF/lib"/>
+		<zipfileset dir="${build.home}" includes="gs3-solrserver.jar" prefix="WEB-INF/lib"/>
+	</war>    
     
-    <echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps</echo>
-    <copy todir="${tomcat.dir}/webapps" file="webapps/solr.war" />
-	<unwar src="${tomcat.dir}/webapps/solr.war" dest="${tomcat.dir}/webapps/solr"/>
-	<echo>Copying xalan related jar files, morphology and gs3-solrserver jars from ${web.libdir} into ${tomcat.dir}/webapps/solr.war</echo>
-    <copy todir="${tomcat.dir}/webapps/solr/WEB-INF/lib">
-      <filelist dir="${web.libdir}" files="${shared-xalan-jars}" />
-      <filelist dir="${build.home}" files="gs3-solrserver.jar" />
-      <filelist dir="lib/russianmorphology" files="${russian-morph-jars}" />
-    </copy>
-	<jar destfile="${tomcat.dir}/webapps/solr.war" basedir="${tomcat.dir}/webapps/solr" />
-	<!-- delete the webapps\solr temporary dir: tomcat will unpack the modified war file on startup-->
-	<delete failonerror="true" dir="${tomcat.dir}/webapps/solr" />
+  	<echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps/${solr.context}.war</echo>
+    <copy file="webapps/solr.war" tofile="${tomcat.dir}/webapps/${solr.context}.war" />
 	
     <echo>Generating solr context file in ${tomcat.context.dir}</echo>
@@ -233,8 +241,9 @@
     <filter token="gsdl3webhome" value="${gsdl3.web.home}"/>
     <filter token="tomcathome" value="${tomcat.home}"/>
-    <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/solr.xml" filtering="true" overwrite="true"/>
+  	<filter token="solr.context" value="${solr.context}"/>
+    <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/${solr.context}.xml" filtering="true" overwrite="true"/>
 
   </target>  
-
+  
   <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
   <target name="copy-solr-web" if="ext.web.exists">
@@ -289,8 +298,8 @@
 	     But if solr.war is deleted first, it can't be re-deployed when deleting the solr folder subsequently
 	  -->
-	<delete failonerror="false" file="${tomcat.dir}/webapps/solr.war"/>
-	<delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/solr"/>
-
-	<delete failonerror="false" file="${tomcat.context.dir}/solr.xml"/>
+	<delete failonerror="false" file="${tomcat.dir}/webapps/${solr.context}.war"/>
+	<delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/${solr.context}"/>
+
+	<delete failonerror="false" file="${tomcat.context.dir}/${solr.context}.xml"/>
 
 	<!-- delete all the jar files in tomcat/lib that were copied from ext/solr/lib/ext
Index: gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in
===================================================================
--- gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in	(revision 32378)
+++ gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in	(revision 32380)
@@ -1,3 +1,3 @@
-<Context docBase="@tomcathome@/webapps/solr.war" 
+<Context docBase="@tomcathome@/webapps/@solr.context@.war" 
 	 debug="0" 
 	 crossContext="true" 
