root/gs3-extensions/solr/trunk/src/build.xml @ 28116

Revision 28116, 6.1 KB (checked in by kjdon, 6 years ago)

also need gutil.jar - contains the GlobalProperties? class

Line 
1<?xml version="1.0"?>
2<project name="gs3-solr-ext" default="usage" basedir=".">
3
4  <!-- DIRECTORY LOCATIONS -->
5  <!-- local ext paths -->
6  <property name="src.home" value="${basedir}/src/java"/>
7  <property name="build.home" value="${basedir}/build"/>
8
9  <!-- greenstone3 paths -->
10  <property name="web.home" value="${basedir}/../../web"/>
11  <property name="localsite.collectdir" value="${web.home}/sites/localsite/collect"/>
12 <property name="web.classesdir" value="${web.home}/WEB-INF/classes"/>
13  <property name="web.libdir" value="${web.home}/WEB-INF/lib"/> 
14  <property name="web.extdir" value="${web.home}/ext/solr"/>
15
16  <path id="compile.classpath">
17    <!-- gs3 jar files we need -->
18    <pathelement location="${web.libdir}/gsdl3.jar"/>
19    <pathelement location="${web.libdir}/gutil.jar"/>
20    <pathelement location="${web.libdir}/LuceneWrapper3.jar"/>
21    <pathelement location="${web.libdir}/gson-1.7.1.jar"/>
22    <!-- local jar files -->
23    <fileset dir="lib/java">
24      <include name="*.jar"/>
25    </fileset>
26  </path>
27
28  <!-- FILE LISTINGS.-->
29  <!-- Created as property elements rather than as filelist elements, since
30    they can then be reused for the add-service and delete-service targets. -->
31  <property name="jars"
32        value="apache-solr-core-3.3.0.jar
33        apache-solr-solrj-3.3.0.jar
34        lucene-spatial-3.3.0.jar
35        lucene-spellchecker-3.3.0.jar
36        lucene-analyzers-3.3.0.jar
37        lucene-highlighter-3.3.0.jar
38        commons-io-1.4.jar
39        commons-fileupload-1.2.1.jar
40        velocity-1.6.1.jar
41        log4j-over-slf4j-1.6.1.jar
42        slf4j-api-1.6.1.jar
43        slf4j-jdk14-1.6.1.jar"/>
44 
45  <property name="java-service-files"
46    value="SolrSearch.java         
47    GS2SolrSearch.java
48    GS2SolrRetrieve.java"/> 
49           
50  <property name="java-util-files"
51    value="SolrFacetWrapper.java
52    SolrQueryWrapper.java           
53    SolrQueryResult.java"/>           
54 
55 <!-- <property name="property-files"
56    value=""/>  -->
57
58           
59  <!-- TARGETS -->
60  <target name="usage" description="Print a help message">
61    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
62    <echo message="  Execute 'ant -help' for Ant help."/>
63    <echo>To install the Solr extension for Greenstone3, run 'ant add-service'.
64    To remove the files and folders installed by add-service, run 'ant del-service'.
65    </echo>
66  </target>         
67 
68  <target name="compile" description="Compile up the solr java classes, jar them up, and install gs3-solr.jar into Greenstone's web/WEB-INF/lib dir">
69    <mkdir dir="${build.home}"/>
70    <javac srcdir="${src.home}"
71      destdir="${build.home}">
72      <classpath>
73    <path refid="compile.classpath"/>
74      </classpath>
75    </javac>
76    <jar destfile="${build.home}/gs3-solr.jar">
77      <fileset dir="${build.home}">
78        <include name="org/greenstone/gsdl3/**"/>
79      </fileset>
80      <manifest>
81        <attribute name="Built-By" value="${user.name}" />
82      </manifest>
83    </jar>
84    <copy file="${build.home}/gs3-solr.jar" todir="${web.libdir}"/>
85  </target>
86 
87  <target name="copy-files" description="Helper-target: copy files across for add-service target">
88   
89    <!-- May want this back if we add in Solr .properties files-->
90<!--    <echo/>
91    <echo>Adding to gsdl3 properties area: properties/${property-files}</echo>
92    <copy todir="${classesdir}">
93          <filelist id="prop-files" dir="properties" files="${property-files}"/>
94    </copy>
95-->
96    <echo/>
97    <echo>Adding to gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars}</echo>
98    <copy todir="${web.libdir}">
99          <filelist id="jar-files" dir="lib/java" files="${jars}"/>
100    </copy>
101   
102    <echo/>
103    <echo>Creating web extension directory: ${web.extdir}</echo>
104    <mkdir dir="${web.extdir}"/>
105   
106    <echo/>
107    <echo>Adding to gsdl3 web solr ext directory: solr.xml</echo>
108    <pathconvert targetos="unix" property="src.gsdl3.home.unix">
109      <path path="../../web"/>
110    </pathconvert>
111    <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
112    <copy file="solr.xml.in" tofile="${web.extdir}/solr.xml" filtering="true" overwrite="true"/>
113   
114    <echo/>
115    <echo>Adding example solr-jdbm-demo collection to ${localsite.collectdir}</echo>
116    <copy todir="${localsite.collectdir}/solr-jdbm-demo"
117          preservelastmodified="true"
118          failonerror="true" > 
119      <fileset dir="${basedir}/collect/solr-jdbm-demo" includes="**"/> 
120    </copy>
121    <echo>Unzipping pre-built index</echo>
122    <unzip dest="${localsite.collectdir}/solr-jdbm-demo" src="${localsite.collectdir}/solr-jdbm-demo/index.zip" />
123
124    <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
125    <available property="ext.web.exists" file="${basedir}/web" type="dir" />
126
127  </target>
128 
129 
130  <target name="add-service" depends="copy-files,compile" if="ext.web.exists"
131    description="Run this target to setup the Solr extension for Greenstone3">
132   
133    <echo/>
134    <echo>Copy to gsdl3 web: the content of the ${basedir}/web folder (excluding .svn)</echo>
135    <copy todir="${web.extdir}">
136          <dirset dir="${basedir}/web">
137        <exclude name=".svn"/>
138      </dirset>
139    </copy>
140
141  </target>
142 
143  <target name="del-service"
144    description="Run this target to unset the Solr extension for Greenstone3"> 
145   
146    <!-- failonerror is set to false in case some files don't exist
147    and can't be deleted therefore -->
148   
149
150<!--   
151    <echo/>
152    <echo>Removing from  gsdl3 properties area: properties/${property-files}</echo>
153    <delete failonerror="false">
154          <filelist dir="${classesdir}" files="${property-files}"/>
155    </delete>
156-->
157    <echo/>
158    <echo>Removing from gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars} gs3-solr.jar</echo>
159    <delete failonerror="false">
160          <filelist dir="${web.libdir}" files="${jars} gs3-solr.jar"/>
161    </delete>   
162   
163    <echo/>
164    <echo>Removing web solr extension directory: ${web.extdir}</echo>
165    <delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}"/>   
166
167    <echo/>
168    <echo>Removing solr-jdbm-demo collection from: ${localsite.collectdir}</echo>
169    <delete failonerror="false" includeEmptyDirs="true" dir="${localsite.collectcdir}/solr-jdbm-demo"/>
170   
171  </target>
172 
173</project>
Note: See TracBrowser for help on using the browser.