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 | <available property="ext.web.exists" file="${basedir}/web" type="dir" />
|
---|
9 |
|
---|
10 | <!-- greenstone3 paths -->
|
---|
11 | <property name="web.home" value="${basedir}/../../web"/>
|
---|
12 | <property name="localsite.collectdir" value="${web.home}/sites/localsite/collect"/>
|
---|
13 | <property name="web.classesdir" value="${web.home}/WEB-INF/classes"/>
|
---|
14 | <property name="web.libdir" value="${web.home}/WEB-INF/lib"/>
|
---|
15 | <property name="web.extdir" value="${web.home}/ext/solr"/>
|
---|
16 |
|
---|
17 | <path id="compile.classpath">
|
---|
18 | <!-- gs3 jar files we need -->
|
---|
19 | <pathelement location="${web.libdir}/gsdl3.jar"/>
|
---|
20 | <pathelement location="${web.libdir}/gutil.jar"/>
|
---|
21 | <pathelement location="${web.libdir}/LuceneWrapper4.jar"/>
|
---|
22 | <pathelement location="${web.libdir}/gson-1.7.1.jar"/>
|
---|
23 | <!-- local jar files -->
|
---|
24 | <fileset dir="lib/java">
|
---|
25 | <include name="*.jar"/>
|
---|
26 | </fileset>
|
---|
27 | </path>
|
---|
28 |
|
---|
29 | <!-- FILE LISTINGS.-->
|
---|
30 | <!-- Created as property elements rather than as filelist elements, since
|
---|
31 | they can then be reused for the add-service and delete-service targets. -->
|
---|
32 | <property name="jars"
|
---|
33 | value="solr-core-4.7.2.jar
|
---|
34 | solr-solrj-4.7.2.jar
|
---|
35 | lucene-core-4.7.2.jar
|
---|
36 | lucene-analyzers-common-4.7.2.jar
|
---|
37 | lucene-analyzers-kuromoji-4.7.2.jar
|
---|
38 | lucene-analyzers-phonetic-4.7.2.jar
|
---|
39 | lucene-grouping-4.7.2.jar
|
---|
40 | lucene-highlighter-4.7.2.jar
|
---|
41 | lucene-queries-4.7.2.jar
|
---|
42 | lucene-queryparser-4.7.2.jar
|
---|
43 | lucene-memory-4.7.2.jar
|
---|
44 | lucene-misc-4.7.2.jar
|
---|
45 | lucene-spatial-4.7.2.jar
|
---|
46 | lucene-suggest-4.7.2.jar
|
---|
47 | httpclient-4.3.1.jar
|
---|
48 | httpcore-4.3.jar
|
---|
49 | httpmime-4.3.1.jar
|
---|
50 | commons-fileupload-1.2.1.jar
|
---|
51 | commons-io-2.1.jar
|
---|
52 | commons-lang-2.6.jar
|
---|
53 | velocity-1.6.1.jar
|
---|
54 | log4j-over-slf4j-1.6.6.jar
|
---|
55 | slf4j-api-1.6.6.jar
|
---|
56 | slf4j-jdk14-1.6.6.jar
|
---|
57 | spatial4j-0.4.1.jar
|
---|
58 | zookeeper-3.4.5.jar
|
---|
59 | guava-14.0.1.jar
|
---|
60 | noggit-0.5.jar"/>
|
---|
61 | <!-- jcl-over-slf4j-1.6.6.jar
|
---|
62 | jul-to-slf4j-1.6.6.jar
|
---|
63 | log4j-1.2.16.jar
|
---|
64 | wstx-asl-3.2.7.jar
|
---|
65 | -->
|
---|
66 | <!--
|
---|
67 | lucene-spellchecker-3.3.0.jar replaced with lucene-suggest-4.7.2.jar, since both contain packages org/.../spell and org/.../suggest
|
---|
68 |
|
---|
69 | commons-fileupload-1.2.1.jar - in solr war file
|
---|
70 | velocity-1.6.1.jar
|
---|
71 | log4j-over-slf4j-1.6.1.jar - have to download slf4j jar file for version 1.6.6
|
---|
72 | slf4j-jdk14-1.6.1.jar - have to download slf4j jar file for version 1.6.6
|
---|
73 | -->
|
---|
74 |
|
---|
75 | <property name="java-service-files"
|
---|
76 | value="SolrSearch.java
|
---|
77 | GS2SolrSearch.java
|
---|
78 | GS2SolrRetrieve.java"/>
|
---|
79 |
|
---|
80 | <property name="java-util-files"
|
---|
81 | value="SolrFacetWrapper.java
|
---|
82 | SolrQueryWrapper.java
|
---|
83 | SolrQueryResult.java"/>
|
---|
84 |
|
---|
85 | <property name="property-files"
|
---|
86 | value="GS2SolrSearch.properties"/>
|
---|
87 |
|
---|
88 |
|
---|
89 | <!-- TARGETS -->
|
---|
90 | <target name="usage" description="Print a help message">
|
---|
91 | <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
|
---|
92 | <echo message=" Execute 'ant -help' for Ant help."/>
|
---|
93 | <echo>To install the Solr extension for Greenstone3, run 'ant add-service'.
|
---|
94 | To remove the files and folders installed by add-service, run 'ant del-service'.
|
---|
95 | </echo>
|
---|
96 | </target>
|
---|
97 |
|
---|
98 | <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">
|
---|
99 | <mkdir dir="${build.home}"/>
|
---|
100 | <javac srcdir="${src.home}" destdir="${build.home}" debug="true">
|
---|
101 | <classpath>
|
---|
102 | <path refid="compile.classpath"/>
|
---|
103 | </classpath>
|
---|
104 | </javac>
|
---|
105 | <jar destfile="${build.home}/gs3-solr.jar">
|
---|
106 | <fileset dir="${build.home}">
|
---|
107 | <include name="org/greenstone/gsdl3/**"/>
|
---|
108 | </fileset>
|
---|
109 | <manifest>
|
---|
110 | <attribute name="Built-By" value="${user.name}" />
|
---|
111 | </manifest>
|
---|
112 | </jar>
|
---|
113 | <copy file="${build.home}/gs3-solr.jar" todir="${web.libdir}"/>
|
---|
114 | </target>
|
---|
115 |
|
---|
116 | <target name="copy-files" description="Helper-target: copy files across for add-service target">
|
---|
117 |
|
---|
118 | <echo/>
|
---|
119 | <echo>Adding to gsdl3 properties area: properties/${property-files}</echo>
|
---|
120 | <copy todir="${web.classesdir}">
|
---|
121 | <filelist id="prop-files" dir="properties" files="${property-files}"/>
|
---|
122 | </copy>
|
---|
123 | <echo/>
|
---|
124 | <echo>Adding to gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars}</echo>
|
---|
125 | <copy todir="${web.libdir}">
|
---|
126 | <filelist id="jar-files" dir="lib/java" files="${jars}"/>
|
---|
127 | </copy>
|
---|
128 |
|
---|
129 | <echo/>
|
---|
130 | <echo>Creating web extension directory: ${web.extdir}</echo>
|
---|
131 | <mkdir dir="${web.extdir}"/>
|
---|
132 |
|
---|
133 | <echo/>
|
---|
134 | <echo>Adding to gsdl3 web solr ext directory: solr.xml and solr.xml.in</echo>
|
---|
135 | <copy file="solr.xml.in" tofile="${web.extdir}/solr.xml.in"/>
|
---|
136 | <pathconvert targetos="unix" property="src.gsdl3.home.unix">
|
---|
137 | <path path="../../web"/>
|
---|
138 | </pathconvert>
|
---|
139 | <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
|
---|
140 | <copy file="solr.xml.in" tofile="${web.extdir}/solr.xml" filtering="true" overwrite="true"/>
|
---|
141 |
|
---|
142 | <echo/>
|
---|
143 | <echo>Adding example solr-jdbm-demo collection to ${localsite.collectdir}</echo>
|
---|
144 | <copy todir="${localsite.collectdir}/solr-jdbm-demo"
|
---|
145 | preservelastmodified="true"
|
---|
146 | failonerror="true" >
|
---|
147 | <fileset dir="${basedir}/collect/solr-jdbm-demo" includes="**"/>
|
---|
148 | </copy>
|
---|
149 | <echo>Unzipping pre-built index</echo>
|
---|
150 | <unzip dest="${localsite.collectdir}/solr-jdbm-demo" src="${localsite.collectdir}/solr-jdbm-demo/index.zip" />
|
---|
151 |
|
---|
152 |
|
---|
153 | </target>
|
---|
154 |
|
---|
155 |
|
---|
156 | <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
|
---|
157 | <target name="copy-solr-web" if="ext.web.exists">
|
---|
158 | <echo/>
|
---|
159 | <echo>Copy to gsdl3 web: the content of the ${basedir}/web folder (excluding .svn)</echo>
|
---|
160 | <copy todir="${web.extdir}">
|
---|
161 | <dirset dir="${basedir}/web">
|
---|
162 | <exclude name=".svn"/>
|
---|
163 | </dirset>
|
---|
164 | </copy>
|
---|
165 | </target>
|
---|
166 |
|
---|
167 | <target name="add-service" depends="copy-solr-web,copy-files,compile" description="Run this target to setup the Solr extension for Greenstone3" />
|
---|
168 |
|
---|
169 |
|
---|
170 | <target name="del-service"
|
---|
171 | description="Run this target to unset the Solr extension for Greenstone3">
|
---|
172 |
|
---|
173 | <!-- failonerror is set to false in case some files don't exist
|
---|
174 | and can't be deleted therefore -->
|
---|
175 |
|
---|
176 |
|
---|
177 |
|
---|
178 | <echo/>
|
---|
179 | <echo>Removing from gsdl3 properties area: properties/${property-files}</echo>
|
---|
180 | <delete failonerror="false">
|
---|
181 | <filelist dir="${web.classesdir}" files="${property-files}"/>
|
---|
182 | </delete>
|
---|
183 |
|
---|
184 | <echo/>
|
---|
185 | <echo>Removing from gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars} gs3-solr.jar</echo>
|
---|
186 | <delete failonerror="false">
|
---|
187 | <filelist dir="${web.libdir}" files="${jars} gs3-solr.jar"/>
|
---|
188 | </delete>
|
---|
189 |
|
---|
190 | <echo/>
|
---|
191 | <echo>Removing web solr extension directory: ${web.extdir}</echo>
|
---|
192 | <delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}"/>
|
---|
193 |
|
---|
194 | <echo/>
|
---|
195 | <echo>Removing solr-jdbm-demo collection from: ${localsite.collectdir}</echo>
|
---|
196 | <delete failonerror="false" includeEmptyDirs="true" dir="${localsite.collectcdir}/solr-jdbm-demo"/>
|
---|
197 |
|
---|
198 | </target>
|
---|
199 |
|
---|
200 | </project>
|
---|