1 <?xml version="1.0" encoding="utf-8" ?>
2 <project name="gss" default="deploy" basedir=".">
3 <description>The GSS project build file</description>
5 <property file="build.properties"/>
6 <property name="deps.dir" value="dependencies"/>
8 <!-- User-editable settings. These are the only settings in this file that
9 a user may consider changing. Note that these can also be configured
10 through command line parameters (e.g. "ant -Dgwt.workers=2") or a
11 build.properties file. -->
12 <property name="gwt.workers" value="1" />
13 <property name="jboss.home" value="${deps.dir}/jboss-5.1.0.GA" />
14 <property name="jboss.args" value="" />
15 <property name="solr.root" value="${deps.dir}/apache-solr-1.4.1"/>
16 <property name="solr.home" value="${deps.dir}/apache-solr-1.4.1/example/solr"/>
18 <!-- Library and runtime dependencies -->
19 <property name="jboss.version" value="5.1.0" />
20 <property name="jboss.filename" value="jboss-5.1.0.GA-jdk6.zip"/>
21 <property name="jboss.download.url" value="http://switch.dl.sourceforge.net/project/jboss/JBoss/JBoss-${jboss.version}.GA/${jboss.filename}"/>
22 <property name="solr.version" value="1.4.1" />
23 <property name="solr.filename" value="apache-solr-1.4.1.zip"/>
24 <property name="solr.download.url" value="http://apache.ntua.gr/lucene/solr/${solr.version}/${solr.filename}"/>
25 <property name="solrj.version" value="1.4.1"/>
26 <property name="solr.dist.path" value="${solr.root}/dist"/>
27 <property name="solrj.jar" value="apache-solr-solrj-${solrj.version}.jar"/>
28 <property name="gwt.path" value="${deps.dir}/gwt-2.0.4"/>
29 <property name="gwt.filename" value="gwt-2.0.4.zip"/>
30 <property name="gwt.download.url" value="http://google-web-toolkit.googlecode.com/files/gwt-2.0.4.zip"/>
31 <property name="hornetq.path" value="${deps.dir}/hornetq-2.0.0.GA" />
32 <property name="hornetq.filename" value="hornetq-2.0.0.GA.zip/"/>
33 <property name="hornetq.download.url" value="http://sourceforge.net/projects/hornetq/files/2.0.0.GA/hornetq-2.0.0.GA.zip/download"/>
34 <property name="junit.path" value="${deps.dir}/junit3.8.1" />
35 <property name="junit.filename" value="junit3.8.1.zip"/>
36 <property name="junit.download.url" value="http://sourceforge.net/projects/junit/files/junit/3.8.1/junit3.8.1.zip/download"/>
37 <property name="gwt-dnd.filename" value="gwt-dnd-3.0.1.jar"/>
38 <property name="gwt-dnd.download.url" value="http://gwt-dnd.googlecode.com/files/gwt-dnd-3.0.1.jar"/>
39 <property name="gwt-gears.path" value="${deps.dir}/gwt-gears-1.3.0" />
40 <property name="gwt-gears.filename" value="gwt-gears-1.3.0.zip"/>
41 <property name="gwt-gears.download.url" value="http://gwt-google-apis.googlecode.com/files/gwt-gears-1.3.0.zip"/>
42 <property name="gwt-visualization.path" value="${deps.dir}/gwt-visualization-1.1.0" />
43 <property name="gwt-visualization.filename" value="gwt-visualization-1.1.0.zip"/>
44 <property name="gwt-visualization.download.url" value="http://gwt-google-apis.googlecode.com/files/gwt-visualization-1.1.0.zip"/>
45 <property name="gwt-incubator.filename" value="gwt-incubator-20100204-r1747.jar"/>
46 <property name="gwt-incubator.download.url" value="http://google-web-toolkit-incubator.googlecode.com/files/gwt-incubator-20100204-r1747.jar"/>
48 <!-- Source and runtime layout configuration -->
49 <property name="jboss_run_configuration" value="default" />
50 <property name="root.context" value="gss" />
51 <property name="gwt.module" value="gr.ebs.gss.GSS" />
52 <property name="gwt.module.class" value="GSS" />
53 <property name="gwt.admin.module" value="gr.ebs.gss.admin.TwoAdmin" />
54 <property name="gwt.admin.module.class" value="TwoAdmin" />
55 <property name="src.dir" value="${basedir}/src"/>
56 <property name="jboss-spec.dir" value="${basedir}/jboss" />
57 <property name="jboss-spec.conf.dir" value="${jboss-spec.dir}/conf" />
58 <property name="jboss-spec.bin.dir" value="${jboss-spec.dir}/bin" />
59 <property name="jboss-spec.deploy.dir" value="${jboss-spec.dir}/deploy" />
60 <property name="jboss-spec.lib.dir" value="${jboss-spec.dir}/lib" />
61 <property name="jboss.project" value="${basedir}/jboss-config/${jboss.version}" />
62 <property name="jboss.bin.dir" value="${jboss.home}/bin" />
63 <property name="jboss.conf.dir" value="${jboss.home}/server/${jboss_run_configuration}/conf" />
64 <property name="jboss.deploy.dir" value="${jboss.home}/server/${jboss_run_configuration}/deploy" />
65 <property name="jboss.run_conf.lib.dir" value="${jboss.home}/server/${jboss_run_configuration}/lib" />
66 <property name="jboss.lib.dir" value="${jboss.home}/lib" />
67 <property name="jboss.common.lib.dir" value="${jboss.home}/common/lib" />
69 <property name="solr-spec.dir" value="${basedir}/solr"/>
70 <property name="solr-spec.conf.dir" value="${solr-spec.dir}/conf"/>
71 <property name="solr.conf.dir" value="${solr.home}/conf"/>
74 <property name="mbeans.dir" value="${basedir}/mbeans"/>
75 <property name="mbeans.meta-inf.dir" value="${mbeans.dir}/META-INF"/>
78 <property name="test.dir" value="${basedir}/test" />
79 <property name="test.src.dir" value="${test.dir}/src"/>
82 <property name="src.dir" value="${basedir}/src}"/>
83 <property name="solr.src.dir" value="${solr-spec.dir}/src"/>
84 <property name="build.dir" value="${basedir}/bin" />
85 <property name="build.classes.dir" value="${build.dir}/classes" />
86 <property name="test.build.dir" value="${build.dir}" />
87 <property name="test.build.classes.dir" value="${test.build.dir}/" />
88 <property name="gwt.www.dir" value="${basedir}/www" />
89 <property name="gwt.www.admin.dir" value="${basedir}/wwwadmin" />
90 <property name="dist.war" value="${ant.project.name}.war"/>
91 <property name="dist.admin.war" value="${ant.project.name}-admin.war"/>
92 <property name="webdav.war" value="webdav.war"/>
93 <property name="dist.ear" value="${ant.project.name}.ear"/>
94 <property name="war.dir" value="${basedir}/war" />
95 <property name="war.web-inf.dir" value="${war.dir}/WEB-INF"/>
96 <property name="war.lib.dir" value="${war.web-inf.dir}/lib"/>
97 <property name="war.admin.dir" value="${basedir}/waradmin" />
98 <property name="war.admin.web-inf.dir" value="${war.dir}/WEB-INF"/>
99 <property name="war.admin.lib.dir" value="${war.web-inf.dir}/lib"/>
100 <property name="webdav.war.dir" value="${basedir}/webdav" />
101 <property name="webdav.war.web-inf.dir" value="${webdav.war.dir}/WEB-INF"/>
102 <property name="webdav.war.lib.dir" value="${webdav.war.web-inf.dir}/lib"/>
103 <property name="ear.dir" value="${basedir}/ear" />
104 <property name="ear.lib.dir" value="${ear.dir}/lib" />
105 <property name="mbeans.dist.file" value="${ant.project.name}-mbeans.sar"/>
107 <!-- set classpath -->
108 <path id="project.class.path">
109 <pathelement path="${java.class.path}/" />
110 <pathelement path="${gwt.path}/gwt-user.jar" />
111 <pathelement location="${jboss.common.lib.dir}/commons-logging.jar"/>
112 <pathelement location="${jboss.common.lib.dir}/ejb3-persistence.jar"/>
113 <pathelement location="${jboss.common.lib.dir}/jboss-ejb3-ext-api.jar"/>
114 <pathelement location="${jboss.common.lib.dir}/jboss-javaee.jar"/>
115 <pathelement location="${jboss.common.lib.dir}/jbosssx.jar"/>
116 <pathelement location="${jboss.common.lib.dir}/hibernate-core.jar"/>
117 <pathelement location="${jboss.common.lib.dir}/hibernate-annotations.jar"/>
118 <pathelement location="${jboss.lib.dir}/jboss-j2se.jar"/>
119 <pathelement location="${jboss.lib.dir}/jboss-kernel.jar"/>
120 <pathelement location="${jboss.lib.dir}/jboss-system-jmx.jar"/>
121 <pathelement location="${jboss.lib.dir}/jboss-system.jar"/>
122 <pathelement location="${jboss.lib.dir}/jbosssx.jar"/>
123 <pathelement location="${ear.lib.dir}/commons-codec-1.4.jar"/>
124 <pathelement location="${ear.lib.dir}/commons-configuration-1.6.jar"/>
125 <pathelement location="${war.lib.dir}/commons-fileupload-1.2.jar"/>
126 <pathelement location="${ear.lib.dir}/commons-httpclient-3.1.jar"/>
127 <pathelement location="${ear.lib.dir}/commons-lang.jar"/>
128 <pathelement location="${ear.lib.dir}/ldap.jar"/>
129 <pathelement location="${junit.path}/junit.jar"/>
130 <pathelement location="${deps.dir}/${gwt-dnd.filename}"/>
131 <pathelement location="${gwt-gears.path}/gwt-gears.jar"/>
132 <pathelement location="${deps.dir}/${gwt-incubator.filename}"/>
133 <pathelement location="${gwt-visualization.path}/gwt-visualization.jar"/>
134 <pathelement location="${solr.dist.path}/${solrj.jar}"/>
137 <target name="check-jboss">
138 <available file="${jboss.home}" type="dir" property="jboss.home.present"/>
141 <target name="fetch-dependencies" description="Fetch the dpendencies" unless="jboss.home.present" depends="check-jboss">
142 <mkdir dir="${deps.dir}"/>
143 <get src="${gwt.download.url}" dest="${deps.dir}/${gwt.filename}" usetimestamp="true"/>
144 <get src="${gwt-dnd.download.url}" dest="${deps.dir}/${gwt-dnd.filename}" usetimestamp="true"/>
145 <get src="${gwt-gears.download.url}" dest="${deps.dir}/${gwt-gears.filename}" usetimestamp="true"/>
146 <get src="${gwt-visualization.download.url}" dest="${deps.dir}/${gwt-visualization.filename}" usetimestamp="true"/>
147 <get src="${gwt-incubator.download.url}" dest="${deps.dir}/${gwt-incubator.filename}" usetimestamp="true"/>
148 <get src="${hornetq.download.url}" dest="${deps.dir}/${hornetq.filename}" usetimestamp="true"/>
149 <get src="${junit.download.url}" dest="${deps.dir}/${junit.filename}" usetimestamp="true"/>
150 <get src="${jboss.download.url}" dest="${deps.dir}/${jboss.filename}" usetimestamp="true"/>
151 <unzip src="${deps.dir}/${gwt.filename}" dest="${deps.dir}"/>
152 <unzip src="${deps.dir}/${gwt-gears.filename}" dest="${deps.dir}"/>
153 <unzip src="${deps.dir}/${gwt-visualization.filename}" dest="${deps.dir}"/>
154 <unzip src="${deps.dir}/${hornetq.filename}" dest="${deps.dir}"/>
155 <unzip src="${deps.dir}/${junit.filename}" dest="${deps.dir}"/>
156 <unzip src="${deps.dir}/${jboss.filename}" dest="${jboss.home}/.."/>
159 <target name="install" depends="fetch-dependencies, install-solr" description="Installs the configuration files of the application server">
160 <!-- Install HornetQ configuration -->
161 <copy todir="${jboss.run_conf.lib.dir}">
162 <fileset dir="${hornetq.path}/lib">
163 <include name="hornetq-*.jar"/>
164 <include name="netty*.jar"/>
167 <property name="hornetq.sar.dir" value="${jboss.deploy.dir}/hornetq.sar"/>
168 <mkdir dir="${hornetq.sar.dir}"/>
169 <copy todir="${hornetq.sar.dir}">
170 <fileset dir="${hornetq.path}/config/jboss-as/non-clustered" includes="*" excludes="**/jboss-as-4/**"/>
172 <unzip src="${hornetq.path}/lib/hornetq-ra.rar" dest="${jboss.deploy.dir}/hornetq-ra.rar"/>
173 <delete dir="${jboss.deploy.dir}/messaging" failonerror="false"/>
174 <mkdir dir="${jboss.bin.dir}/META-INF/lib/linux2/x86"/>
175 <mkdir dir="${jboss.bin.dir}/META-INF/lib/linux2/x64"/>
176 <copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x86" file="${hornetq.path}/bin/libHornetQAIO32.so"/>
177 <copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x64" file="${hornetq.path}/bin/libHornetQAIO64.so"/>
178 <!-- Install gss configuration -->
179 <copy todir="${jboss.bin.dir}" overwrite="true" failonerror="false">
180 <fileset dir="${jboss.project}/bin"/>
182 <copy todir="${jboss.bin.dir}" overwrite="true" failonerror="false">
183 <fileset dir="${jboss-spec.bin.dir}" />
185 <copy todir="${jboss.conf.dir}" overwrite="true" failonerror="false">
186 <fileset dir="${jboss.project}/conf"/>
188 <copy todir="${jboss.conf.dir}" overwrite="true" failonerror="false">
189 <fileset dir="${jboss-spec.conf.dir}"/>
191 <copy todir="${jboss.run_conf.lib.dir}" overwrite="true" failonerror="false">
192 <fileset dir="${jboss.project}/lib"/>
194 <copy todir="${jboss.run_conf.lib.dir}" overwrite="true" failonerror="false">
195 <fileset dir="${jboss-spec.lib.dir}" />
197 <copy todir="${jboss.deploy.dir}" overwrite="true" failonerror="false">
198 <fileset dir="${jboss.project}/deploy"/>
200 <copy todir="${jboss.deploy.dir}" overwrite="true" failonerror="false">
201 <fileset dir="${jboss-spec.deploy.dir}" />
203 <!-- Make run.sh executable again -->
204 <chmod file="${jboss.bin.dir}/run.sh" perm="ugo+x"/>
207 <target name="compile" description="Compile src to bin">
208 <mkdir dir="${build.dir}" />
209 <javac srcdir="${src.dir}:${test.src.dir}" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source" source="1.6">
210 <classpath refid="project.class.path" />
214 <target name="package-code" depends="compile" description="Package up the project code as a jar">
215 <jar destfile="${build.dir}/${ant.project.name}.jar">
217 <include name="org/json/**" />
218 <include name="**/client/AdminService.class" />
219 <include name="**/server/**" />
220 <exclude name="**/domain/**"/>
221 <exclude name="**/ejb/**"/>
224 <include name="**/*.xml" />
225 <include name="**/client/exceptions/**" />
230 <target name="package-webdav" depends="compile" description="Package up the webdav code as a jar">
231 <jar destfile="${build.dir}/webdav.jar">
233 <include name="**/webdav/**" />
238 <target name="package-ejb" depends="compile" description="Package up the EJB classes">
239 <jar destfile="${build.dir}/ejbs.jar">
240 <zipfileset dir="${basedir}/persistence" />
241 <zipfileset dir="${build.dir}">
242 <include name="**/configuration/**" />
243 <include name="**/exceptions/**" />
244 <include name="**/domain/**" />
245 <include name="**/ejb/**" />
246 <exclude name="**/*Test.class"/>
251 <target name="check-gwt-compile" depends="compile">
252 <uptodate property="compilation-not-needed">
253 <srcfiles dir="${src.dir}" excludes="**/server/**"/>
254 <mergemapper to="${build.dir}/www/gr.ebs.gss.GSS.nocache.js"/>
258 <target name="gwt-compile" depends="check-gwt-compile" unless="compilation-not-needed" description="Compile client code to JavaScript">
259 <condition property="gwt-dev-lib" value="${gwt.path}/gwt-dev.jar">
260 <available file="${gwt.path}/gwt-dev.jar" />
263 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
264 <!--arg value="-style"/>
265 <arg value="DETAILED"/-->
266 <arg value="-localWorkers" />
267 <arg value="${gwt.workers}" />
269 <arg value="${gwt.www.dir}"/>
270 <arg value="${gwt.module}"/>
273 <pathelement path="${gwt-dev-lib}"/>
274 <path refid="project.class.path" />
275 <pathelement path="${src.dir}" />
278 <mkdir dir="${build.dir}/www"/>
279 <copy todir="${build.dir}/www">
280 <fileset dir="${gwt.www.dir}/${gwt.module}" excludes="**/${gwt.module.class}.html">
283 <copy file="${gwt.www.dir}/${gwt.module}/${gwt.module.class}.html" tofile="${build.dir}/www/index.html" />
286 <target name="package-war" depends="gwt-compile, package-code" description="Package up the web part as a war">
287 <jar destfile="${build.dir}/${dist.war}">
288 <zipfileset dir="${war.dir}" >
289 <exclude name="**/classes/**"/>
291 <zipfileset dir="${build.dir}/www" />
292 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
293 <include name="${ant.project.name}.jar" />
298 <target name="check-gwt-admin-compile" depends="compile">
299 <uptodate property="compilation-not-needed">
300 <srcfiles dir="${src.dir}" excludes="**/server/**"/>
301 <mergemapper to="${build.dir}/wwwadmin/gr.ebs.gss.admin.TwoAdmin.nocache.js"/>
305 <target name="gwt-admin-compile" depends="check-gwt-admin-compile" unless="compilation-not-needed" description="Compile client code to JavaScript">
306 <condition property="gwt-dev-lib" value="${gwt.path}/gwt-dev.jar">
307 <available file="${gwt.path}/gwt-dev.jar" />
310 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
311 <!--arg value="-style"/>
312 <arg value="DETAILED"/-->
313 <arg value="-localWorkers" />
314 <arg value="${gwt.workers}" />
316 <arg value="${gwt.www.admin.dir}"/>
317 <arg value="${gwt.admin.module}"/>
318 <jvmarg value="-Xmx128m"/>
320 <pathelement path="${gwt-dev-lib}"/>
321 <path refid="project.class.path" />
322 <pathelement path="${src.dir}" />
325 <mkdir dir="${build.dir}/wwwadmin"/>
326 <copy todir="${build.dir}/wwwadmin">
327 <fileset dir="${gwt.www.admin.dir}/${gwt.admin.module}" excludes="**/${gwt.admin.module.class}.html">
330 <copy file="${gwt.www.admin.dir}/${gwt.admin.module}/${gwt.admin.module.class}.html" tofile="${build.dir}/wwwadmin/index.html" />
333 <target name="package-admin-war" depends="gwt-admin-compile, package-code" description="Package up the web part as a war">
334 <jar destfile="${build.dir}/${dist.admin.war}">
335 <zipfileset dir="${war.admin.dir}" >
336 <exclude name="**/classes/**"/>
338 <zipfileset dir="${build.dir}/wwwadmin" />
339 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
340 <include name="${ant.project.name}.jar" />
342 <zipfileset dir="${gwt.path}" prefix="WEB-INF/lib">
343 <include name="gwt-servlet.jar" />
348 <target name="package-webdav-war" depends="package-webdav" description="Package up the WebDAV part as a war">
349 <jar destfile="${build.dir}/${webdav.war}">
350 <zipfileset dir="${webdav.war.dir}" />
351 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
352 <include name="webdav.jar" />
357 <target name="package-mbeans" depends="compile">
358 <jar jarfile="${build.dir}/${mbeans.dist.file}" basedir="${build.dir}">
359 <include name="**/mbeans/**"/>
360 <metainf dir="${mbeans.meta-inf.dir}"/>
364 <target name="package-ear" depends="package-admin-war, package-war, package-webdav-war, package-ejb, package-mbeans" description="Package up the project as an ear">
365 <jar destfile="${build.dir}/${dist.ear}">
366 <zipfileset dir="${ear.dir}" />
367 <zipfileset dir="${build.dir}" >
368 <include name="ejbs.jar" />
369 <include name="${dist.war}" />
370 <include name="${webdav.war}" />
371 <include name="${dist.admin.war}" />
372 <include name="${mbeans.dist.file}"/>
374 <zipfileset dir="${solr.dist.path}" prefix="lib">
375 <include name="${solrj.jar}" />
380 <target name="deploy" depends="package-ear" description="Deploy the project to the server">
381 <copy todir="${jboss.deploy.dir}" file="${build.dir}/${dist.ear}"/>
384 <target name="redeploy" depends="package-ear" description="Redeploy the project to the server">
385 <copy todir="${jboss.deploy.dir}" file="${build.dir}/${dist.ear}" overwrite="yes"/>
388 <target name="undeploy" description="Undeploy the project from the server">
389 <delete file="${jboss.deploy.dir}/${dist.ear}"/>
392 <target name="clean" description="Delete the contents of the bin and www directories">
393 <delete dir="${build.dir}"/>
394 <delete dir="${gwt.www.dir}"/>
395 <delete dir="${gwt.www.admin.dir}"/>
398 <target name="deinstall"
399 description="Delete the contents of the JBoss home directory">
400 <delete dir="${jboss.home}"/>
403 <target name="distclean" depends="deinstall, clean"
404 description="Delete the contents of the JBoss home directory and all downloaded artifacts">
405 <delete dir="${deps.dir}"/>
408 <target name="test" description="Performs unit tests on the project" depends="compile">
410 property="junit.present"
411 classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
412 classpathref="project.class.path"/>
413 <fail unless="junit.present">
414 ##################################################################
416 Please make sure junit.jar is in ANT_HOME/lib, or made available
417 to Ant using other mechanisms like -lib or CLASSPATH.
418 ##################################################################
421 <junit printsummary="withOutAndErr" fork="yes" haltonfailure="yes">
422 <classpath refid="project.class.path"/>
423 <formatter type="plain"/>
424 <batchtest todir="${test.build.dir}">
425 <fileset dir="${test.build.classes.dir}">
426 <include name="**/*Test.class"/>
433 <target name="run" description="Starts the server" depends="deploy">
434 <exec executable="${jboss.bin.dir}/run.sh" osfamily="unix">
435 <arg line="${jboss.args}"/>
437 <exec executable="cmd" osfamily="windows">
439 <arg value="${jboss.bin.dir}/run.bat"/>
440 <arg line="${jboss.args}"/>
444 <target name="check-solr">
445 <available file="${solr.root}" type="dir" property="solr.home.present"/>
448 <target name="fetch-solr" unless="solr.home.present" depends="check-solr">
449 <get src="${solr.download.url}" dest="${deps.dir}/${solr.filename}" usetimestamp="true"/>
450 <unzip src="${deps.dir}/${solr.filename}" dest="${deps.dir}"/>
453 <target name="compile-solr" depends="fetch-solr">
454 <mkdir dir="${build.dir}"/>
455 <javac srcdir="${solr.src.dir}" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source" source="1.6">
456 <classpath refid="project.class.path" />
460 <target name="install-solr" depends="fetch-solr, compile-solr">
461 <copy todir="${solr.conf.dir}" overwrite="true" failonerror="false">
462 <fileset dir="${solr-spec.conf.dir}" />
464 <jar destfile="${solr.root}/greektokenfilter.jar">
465 <fileset dir="${build.dir}">
466 <include name="gr/ebs/gss/solr/analysis/GreekLowerCaseFilterFactory.class"/>
471 <target name="run-solr" depends="install-solr">
472 <java jar="${solr.root}/example/start.jar" fork="true" dir="${solr.root}/example"/>