NIHVIVO-2757 Make solr deploy part of the main build process.

This commit is contained in:
j2blake 2011-07-11 18:32:46 +00:00
parent bebc08fb8b
commit d9ea4c915f
4 changed files with 73 additions and 132 deletions

View file

@ -1,114 +0,0 @@
<?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>

Binary file not shown.

View file

@ -25,7 +25,7 @@
<property name="test-classes.dir" location="${build.dir}/testclasses" /> <property name="test-classes.dir" location="${build.dir}/testclasses" />
<property name="servletjars.dir" location="${build.dir}/servletjars" /> <property name="servletjars.dir" location="${build.dir}/servletjars" />
<property name="javac.deprecation" value="true" /> <property name="javac.deprecation" value="true" />
<!-- - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - -
@ -73,13 +73,6 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
================================= --> ================================= -->
<target name="all" depends="clean, deploy" description="--> Run 'clean', then 'deploy'" /> <target name="all" depends="clean, deploy" description="--> Run 'clean', then 'deploy'" />
<!-- =================================
target: clean
================================= -->
<target name="clean" description="--> Delete all artifacts.">
<delete dir="${build.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - -
target: properties target: properties
- - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - - - -->
@ -117,6 +110,23 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<fail unless="rootUser.emailAddress" <fail unless="rootUser.emailAddress"
message="${deploy.properties.file} must contain a value for rootUser.emailAddress" /> message="${deploy.properties.file} must contain a value for rootUser.emailAddress" />
<fail message="The vitro.home.directory &quot;${vitro.home.directory}&quot; does not exist.">
<condition>
<not>
<available file="${vitro.home.directory}" />
</not>
</condition>
</fail>
<property name="solr.home" location="${vitro.home.directory}/solr" />
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" depends="properties" description="--> Delete all artifacts.">
<delete dir="${build.dir}" />
<delete dir="${solr.home}" excludes="data/**/*" includeemptydirs="true" />
</target> </target>
<!-- - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - -
@ -219,7 +229,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
debug="true" debug="true"
deprecation="${javac.deprecation}" deprecation="${javac.deprecation}"
encoding="UTF8" encoding="UTF8"
includeantruntime="false" includeantruntime="false"
optimize="true" optimize="true"
source="1.6"> source="1.6">
<classpath refid="compile.classpath" /> <classpath refid="compile.classpath" />
@ -235,7 +245,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
debug="true" debug="true"
deprecation="${javac.deprecation}" deprecation="${javac.deprecation}"
encoding="UTF8" encoding="UTF8"
includeantruntime="false" includeantruntime="false"
optimize="false" optimize="false"
source="1.6"> source="1.6">
<classpath refid="test.compile.classpath" /> <classpath refid="test.compile.classpath" />
@ -253,7 +263,10 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<!-- ================================= <!-- =================================
target: revisionInfo target: revisionInfo
================================= --> ================================= -->
<target name="revisionInfo" depends="test" unless="skipinfo" description="--> Store revision info in build"> <target name="revisionInfo"
depends="test"
unless="skipinfo"
description="--> Store revision info in build">
<property name="revisionInfo.product.dir" location="${ant.file.vitroCore}/.." /> <property name="revisionInfo.product.dir" location="${ant.file.vitroCore}/.." />
<property name="revisionInfo.build.file" location="${war-resources.dir}/revisionInfo.txt" /> <property name="revisionInfo.build.file" location="${war-resources.dir}/revisionInfo.txt" />
@ -270,7 +283,7 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
debug="true" debug="true"
deprecation="${javac.deprecation}" deprecation="${javac.deprecation}"
encoding="UTF8" encoding="UTF8"
includeantruntime="false" includeantruntime="false"
optimize="false" optimize="false"
source="1.6"> source="1.6">
</javac> </javac>
@ -285,11 +298,54 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
</java> </java>
</target> </target>
<!-- - - - - - - - - - - - - - - - - -
target: prepareSolr
- - - - - - - - - - - - - - - - - -->
<target name="prepareSolr" depends="properties">
<property name="solr.distrib.dir" location="${webapp.dir}/../solr" />
<property name="solr.example.dir" location="${solr.distrib.dir}/exampleSolr" />
<property name="solr.context.config.example"
location="${solr.distrib.dir}/exampleSolrContext.xml" />
<property name="solr.war" location="${solr.distrib.dir}/apache-solr-3.1.0.war" />
<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>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: deploySolr
- - - - - - - - - - - - - - - - - -->
<target name="deploySolr" depends="prepareSolr" unless="noSolrDeploy">
<copy todir="${tomcat.home}/conf/Catalina/localhost">
<fileset file="${solr.context.config}" />
</copy>
</target>
<!-- ================================= <!-- =================================
target: deploy target: deploy
================================= --> ================================= -->
<target name="deploy" <target name="deploy"
depends="revisionInfo" depends="revisionInfo, deploySolr"
description="--> Build the app and install in Tomcat"> description="--> Build the app and install in Tomcat">
<property name="webapp.deploy.home" value="${tomcat.home}/webapps/${webapp.name}" /> <property name="webapp.deploy.home" value="${tomcat.home}/webapps/${webapp.name}" />
@ -299,14 +355,12 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
<fileset dir="${build.dir}/war" /> <fileset dir="${build.dir}/war" />
</sync> </sync>
</target> </target>
<!-- ================================= <!-- =================================
target: war target: war
================================= --> ================================= -->
<target name="war" <target name="war" depends="revisionInfo" description="--> Build the app and create a WAR file">
depends="revisionInfo" <jar basedir="${build.dir}/war" destfile="${build.dir}/${webapp.name}.war" />
description="--> Build the app and create a WAR file">
<jar basedir="${build.dir}/war" destfile="${build.dir}/${webapp.name}.war"/>
</target> </target>
<!-- ================================= <!-- =================================

View file

@ -220,6 +220,7 @@
<target name="deploy" description="--> Build the app and install in Tomcat"> <target name="deploy" description="--> Build the app and install in Tomcat">
<!-- the inner "deploy" would just do a sync that will be done by productDeploy --> <!-- the inner "deploy" would just do a sync that will be done by productDeploy -->
<innercall target="revisionInfo" /> <innercall target="revisionInfo" />
<innercall target="deploySolr" />
<antcall target="productDeploy" /> <antcall target="productDeploy" />
</target> </target>