vitro/solr/build.xml

114 lines
4.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- ===========================================
Deploy script for basic solr webapp for use by a vitro webapp.
Vitro should be deployed before this script is run.
=========================================== -->
<project name="vitroSolr" default="describe">
<property name="ant.task.dir" location="../utilities/buildutils"/>
<property name="solr.build.dir" location="."/>
<property name="solr.example.dir" location="${solr.build.dir}/exampleSolr" />
<property name="solr.context.config.example" location="${solr.build.dir}/exampleSolrContext.xml"/>
<property name="solr.war" location="${solr.build.dir}/apache-solr-3.1.0.war"/>
<!-- =================================
target: describe
================================= -->
<target name="describe" description="--> Describe the targets (this is the default).">
<echo>
deploy - Deploy solr service for use by vitro.
makeSolrjClientJar - Isolate solrj libraries in single jar.
</echo>
</target>
<!-- =================================
target: deploy
================================= -->
<target name="deploy" depends="properties" description="Deploy solr service for use by vitro.">
<property name="solr.home" location="${vitro.home.directory}/solr"/>
<property name="solr.docbase" location="${solr.home}/solr.war"/>
<property name="solr.context.name" value="${webapp.name}solr"/>
<property name="solr.context.config" location="${solr.home}/${solr.context.name}.xml"/>
<!-- Create and copy the example directory to the solr.home directory. -->
<mkdir dir="${solr.home}"/>
<copy todir="${solr.home}">
<fileset dir="${solr.example.dir}" includes="**/*"/>
</copy>
<!-- Add the war file. -->
<copy tofile="${solr.docbase}">
<fileset file="${solr.war}"/>
</copy>
<!-- Create the context configuration XML with expanded properties. -->
<copy tofile="${solr.context.config}" filtering="true">
<fileset file="${solr.context.config.example}"/>
<filterchain>
<expandproperties />
</filterchain>
</copy>
<!-- Place context configuration XML in tomcat config directory. -->
<copy todir="${tomcat.home}/conf/Catalina/localhost">
<fileset file="${solr.context.config}"/>
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: properties
- - - - - - - - - - - - - - - - - -->
<target name="properties">
<!--<property name="deploy.properties.file" location="deploy.properties" /> -->
<fail unless="deploy.properties.file"
message="The ant property deploy.properties.file must be defined to indicate the vitro deploy to create a solr service for." />
<fail message="There is no accessable deploy.properties file at &quot;${deploy.properties.file}&quot;.">
<condition>
<not>
<available file="${deploy.properties.file}" />
</not>
</condition>
</fail>
<property file="${deploy.properties.file}" />
<fail unless="tomcat.home"
message="${deploy.properties.file} must contain a value for tomcat.home" />
<fail unless="webapp.name"
message="${deploy.properties.file} must contain a value for webapp.name" />
<fail unless="vitro.home.directory"
message="${deploy.properties.file} must contain a value for vitro.home.directory"/>
</target>
<target name="makeSolrjClientJar" >
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${ant.task.dir}/jarjar.jar"/>
<jarjar jarfile="./solrjClient.jar">
<zipfileset src="./solrjClientLibs/apache-solr-core-3.1.0.jar"/>
<zipfileset src="./solrjClientLibs/apache-solr-solrj-3.1.0.jar"/>
<zipfileset src="./solrjClientLibs/commons-codec-1.4.jar"/>
<zipfileset src="./solrjClientLibs/commons-httpclient-3.1.jar"/>
<zipfileset src="./solrjClientLibs/commons-io-1.4.jar"/>
<zipfileset src="./solrjClientLibs/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
<zipfileset src="./solrjClientLibs/jcl-over-slf4j-1.5.5.jar"/>
<zipfileset src="./solrjClientLibs/wstx-asl-3.2.7.jar"/>
<!-- leave the slf4j stuff out because it is broken by design -->
<rule pattern="org.apache.**" result="isoloated.org.apache.@1"/>
<rule pattern="org.codehaus.**" result="isoloated.org.codehaus.@1"/>
<rule pattern="com.ctc.**" result="isoloated.com.ctc.@1"/>
</jarjar>
</target>
</project>