Ignore:
Timestamp:
2018-08-25T00:49:19+12:00 (6 years ago)
Author:
Georgiy Litvinov
Message:

Modified ant scripts for using Solr in external Tomcat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/build.xml

    r31859 r32380  
    44  <!-- DIRECTORY LOCATIONS -->
    55  <!-- local ext paths -->
     6  <loadproperties prefix="gs3." srcFile="${basedir}/../../build.properties"/>
    67  <property name="src.home" value="${basedir}/src/java"/>
    78  <property name="build.home" value="${basedir}/build"/>
     
    1718  <property name="web.extdir" value="${web.home}/ext/solr"/>
    1819
    19   <property name="tomcat.dir" location="${basedir}/../../packages/tomcat"/> <!-- location property creates an absolute path -->
     20  <condition property="tomcat.dir" value="${gs3.tomcat.installed.path}" else="${basedir}/../../packages/tomcat">
     21    <and>
     22      <isset property="gs3.tomcat.installed.path"/>
     23      <not>
     24        <equals arg1="${gs3.tomcat.installed.path}" arg2=""/>
     25      </not>
     26    </and>
     27  </condition>
     28  <condition property="solr.context" value="${gs3.solr.context}" else="solr">
     29    <and>
     30      <isset property="gs3.solr.context"/>
     31      <not>
     32        <equals arg1="${gs3.solr.context}" arg2=""/>
     33      </not>
     34    </and>
     35  </condition>
    2036  <property name="tomcat.lib.dir" value="${tomcat.dir}/lib"/>
    2137  <property name="tomcat.context.dir" value="${tomcat.dir}/conf/Catalina/localhost"/>
    22 
     38   
     39       
    2340  <path id="compile.classpath">
    2441    <!-- gs3 jar files we need -->
     
    112129    value="GS2SolrSearch.properties"/> -->
    113130
    114            
     131
    115132  <!-- TARGETS -->
    116133  <target name="usage" description="Print a help message">
     
    196213  <target name="solr-for-tomcat" description="Helper-target: setting up solr to work tomcat">
    197214   
    198     <echo>Copying solr jars needed for running solr with tomcat: ${basedir}/lib/ext</echo> 
    199     <copy todir="${tomcat.lib.dir}">     
    200       <fileset dir="lib/ext">
    201     <include name="*.jar"/>
    202       </fileset>
    203     </copy>
    204    
    205215    <!-- slf4j and commons logging bridge needed to avoid exception about incompatibility in tomcat log files-->
    206216    <echo>Copying ${basedir}/lib/ext/jcl-over-slf4j-1.6.6.jar again to ${web.libdir}</echo>
     
    208218      <filelist id="logging-bridge" dir="lib/ext" files="jcl-over-slf4j-1.6.6.jar"/>
    209219    </copy>
     220   
     221    <echo>Upddating xalan related jar files, morphology and gs3-solrserver jars from ${web.libdir} in solr.war</echo>
     222    <war destfile="webapps/solr.war" update="true" >
     223        <zipfileset dir="lib/russianmorphology" includes="*.jar" prefix="WEB-INF/lib"/>
     224        <zipfileset dir="lib/ext" includes="*.jar" prefix="WEB-INF/lib"/>
     225        <zipfileset dir="${web.libdir}" includes="${shared-xalan-jars}" prefix="WEB-INF/lib"/>
     226        <zipfileset dir="${build.home}" includes="gs3-solrserver.jar" prefix="WEB-INF/lib"/>
     227    </war>   
    210228   
    211     <echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps</echo>
    212     <copy todir="${tomcat.dir}/webapps" file="webapps/solr.war" />
    213     <unwar src="${tomcat.dir}/webapps/solr.war" dest="${tomcat.dir}/webapps/solr"/>
    214     <echo>Copying xalan related jar files, morphology and gs3-solrserver jars from ${web.libdir} into ${tomcat.dir}/webapps/solr.war</echo>
    215     <copy todir="${tomcat.dir}/webapps/solr/WEB-INF/lib">
    216       <filelist dir="${web.libdir}" files="${shared-xalan-jars}" />
    217       <filelist dir="${build.home}" files="gs3-solrserver.jar" />
    218       <filelist dir="lib/russianmorphology" files="${russian-morph-jars}" />
    219     </copy>
    220     <jar destfile="${tomcat.dir}/webapps/solr.war" basedir="${tomcat.dir}/webapps/solr" />
    221     <!-- delete the webapps\solr temporary dir: tomcat will unpack the modified war file on startup-->
    222     <delete failonerror="true" dir="${tomcat.dir}/webapps/solr" />
     229    <echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps/${solr.context}.war</echo>
     230    <copy file="webapps/solr.war" tofile="${tomcat.dir}/webapps/${solr.context}.war" />
    223231   
    224232    <echo>Generating solr context file in ${tomcat.context.dir}</echo>
     
    233241    <filter token="gsdl3webhome" value="${gsdl3.web.home}"/>
    234242    <filter token="tomcathome" value="${tomcat.home}"/>
    235     <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/solr.xml" filtering="true" overwrite="true"/>
     243    <filter token="solr.context" value="${solr.context}"/>
     244    <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/${solr.context}.xml" filtering="true" overwrite="true"/>
    236245
    237246  </target> 
    238 
     247 
    239248  <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
    240249  <target name="copy-solr-web" if="ext.web.exists">
     
    289298         But if solr.war is deleted first, it can't be re-deployed when deleting the solr folder subsequently
    290299      -->
    291     <delete failonerror="false" file="${tomcat.dir}/webapps/solr.war"/>
    292     <delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/solr"/>
    293 
    294     <delete failonerror="false" file="${tomcat.context.dir}/solr.xml"/>
     300    <delete failonerror="false" file="${tomcat.dir}/webapps/${solr.context}.war"/>
     301    <delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/${solr.context}"/>
     302
     303    <delete failonerror="false" file="${tomcat.context.dir}/${solr.context}.xml"/>
    295304
    296305    <!-- delete all the jar files in tomcat/lib that were copied from ext/solr/lib/ext
Note: See TracChangeset for help on using the changeset viewer.