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.lib" value="${solr.root}/lib"/>
17 <property name="solr.dist" value="${solr.root}/dist"/>
18 <property name="solr.home" value="${deps.dir}/apache-solr-1.4.1/example/solr"/>
20 <!-- Library and runtime dependencies -->
21 <property name="jboss.version" value="5.1.0" />
22 <property name="jboss.filename" value="jboss-5.1.0.GA-jdk6.zip"/>
23 <property name="jboss.download.url" value="http://switch.dl.sourceforge.net/project/jboss/JBoss/JBoss-${jboss.version}.GA/${jboss.filename}"/>
24 <property name="solr.version" value="1.4.1" />
25 <property name="solr.filename" value="apache-solr-1.4.1.zip"/>
26 <property name="solr.download.url" value="http://apache.ntua.gr/lucene/solr/${solr.version}/${solr.filename}"/>
27 <property name="solrj.version" value="1.4.1"/>
28 <property name="solrj.jar" value="apache-solr-solrj-${solrj.version}.jar"/>
29 <property name="gwt.path" value="${deps.dir}/gwt-2.1.1"/>
30 <property name="gwt.filename" value="gwt-2.1.1.zip"/>
31 <property name="gwt.download.url" value="http://google-web-toolkit.googlecode.com/files/gwt-2.1.1.zip"/>
32 <property name="hornetq.path" value="${deps.dir}/hornetq-2.0.0.GA" />
33 <property name="hornetq.filename" value="hornetq-2.0.0.GA.zip/"/>
34 <property name="hornetq.download.url" value="http://sourceforge.net/projects/hornetq/files/2.0.0.GA/hornetq-2.0.0.GA.zip/download"/>
35 <property name="junit.path" value="${deps.dir}/junit3.8.1" />
36 <property name="junit.filename" value="junit3.8.1.zip"/>
37 <property name="junit.download.url" value="http://sourceforge.net/projects/junit/files/junit/3.8.1/junit3.8.1.zip/download"/>
38 <property name="gwt-dnd.filename" value="gwt-dnd-3.0.1.jar"/>
39 <property name="gwt-dnd.download.url" value="http://gwt-dnd.googlecode.com/files/gwt-dnd-3.0.1.jar"/>
40 <property name="gwt-gears.path" value="${deps.dir}/gwt-gears-1.3.0" />
41 <property name="gwt-gears.filename" value="gwt-gears-1.3.0.zip"/>
42 <property name="gwt-gears.download.url" value="http://gwt-google-apis.googlecode.com/files/gwt-gears-1.3.0.zip"/>
43 <property name="gwt-visualization.path" value="${deps.dir}/gwt-visualization-1.1.0" />
44 <property name="gwt-visualization.filename" value="gwt-visualization-1.1.0.zip"/>
45 <property name="gwt-visualization.download.url" value="http://gwt-google-apis.googlecode.com/files/gwt-visualization-1.1.0.zip"/>
46 <property name="gwt-incubator.filename" value="gwt-incubator-20101117-r1766.jar"/>
47 <property name="gwt-incubator.download.url" value="http://google-web-toolkit-incubator.googlecode.com/files/gwt-incubator-20101117-r1766.jar"/>
49 <!-- Source and runtime layout configuration -->
50 <property name="jboss_run_configuration" value="default" />
51 <property name="root.context" value="gss" />
52 <property name="gwt.module" value="gr.ebs.gss.GSS" />
53 <property name="gwt.module.class" value="GSS" />
54 <property name="gwt.admin.module" value="gr.ebs.gss.admin.TwoAdmin" />
55 <property name="gwt.admin.module.class" value="TwoAdmin" />
56 <property name="src.dir" value="${basedir}/src"/>
57 <property name="jboss-spec.dir" value="${basedir}/jboss" />
58 <property name="jboss-spec.conf.dir" value="${jboss-spec.dir}/conf" />
59 <property name="jboss-spec.bin.dir" value="${jboss-spec.dir}/bin" />
60 <property name="jboss-spec.deploy.dir" value="${jboss-spec.dir}/deploy" />
61 <property name="jboss-spec.lib.dir" value="${jboss-spec.dir}/lib" />
62 <property name="jboss.project" value="${basedir}/jboss-config/${jboss.version}" />
63 <property name="jboss.bin.dir" value="${jboss.home}/bin" />
64 <property name="jboss.conf.dir" value="${jboss.home}/server/${jboss_run_configuration}/conf" />
65 <property name="jboss.deploy.dir" value="${jboss.home}/server/${jboss_run_configuration}/deploy" />
66 <property name="jboss.run_conf.lib.dir" value="${jboss.home}/server/${jboss_run_configuration}/lib" />
67 <property name="jboss.lib.dir" value="${jboss.home}/lib" />
68 <property name="jboss.common.lib.dir" value="${jboss.home}/common/lib" />
70 <property name="solr-spec.dir" value="${basedir}/solr"/>
71 <property name="solr-spec.conf.dir" value="${solr-spec.dir}/conf"/>
72 <property name="solr.conf.dir" value="${solr.home}/conf"/>
75 <property name="mbeans.dir" value="${basedir}/mbeans"/>
76 <property name="mbeans.meta-inf.dir" value="${mbeans.dir}/META-INF"/>
79 <property name="test.dir" value="${basedir}/test" />
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}/${solrj.jar}"/>
135 <pathelement location="${solr.dist}/apache-solr-core-1.4.1.jar"/>
136 <pathelement location="${solr.lib}/lucene-core-2.9.3.jar"/>
137 <pathelement location="${solr.lib}/lucene-analyzers-2.9.3.jar"/>
140 <target name="check-jboss">
141 <available file="${jboss.home}" type="dir" property="jboss.home.present"/>
144 <target name="fetch-dependencies" description="Fetch the dpendencies" depends="check-jboss">
145 <mkdir dir="${deps.dir}"/>
147 <get src="${gwt-dnd.download.url}" dest="${deps.dir}/${gwt-dnd.filename}" usetimestamp="true"/>
148 <get src="${gwt-gears.download.url}" dest="${deps.dir}/${gwt-gears.filename}" usetimestamp="true"/>
149 <get src="${gwt-visualization.download.url}" dest="${deps.dir}/${gwt-visualization.filename}" usetimestamp="true"/>
151 <get src="${hornetq.download.url}" dest="${deps.dir}/${hornetq.filename}" usetimestamp="true"/>
152 <get src="${junit.download.url}" dest="${deps.dir}/${junit.filename}" usetimestamp="true"/>
153 <get src="${jboss.download.url}" dest="${deps.dir}/${jboss.filename}" usetimestamp="true"/>
155 <get src="${gwt.download.url}" dest="${deps.dir}/${gwt.filename}" usetimestamp="true"/>
156 <get src="${gwt-incubator.download.url}" dest="${deps.dir}/${gwt-incubator.filename}" usetimestamp="true"/>
157 <unzip src="${deps.dir}/${gwt.filename}" dest="${deps.dir}"/>
160 <unzip src="${deps.dir}/${gwt-gears.filename}" dest="${deps.dir}"/>
161 <unzip src="${deps.dir}/${gwt-visualization.filename}" dest="${deps.dir}"/>
162 <unzip src="${deps.dir}/${hornetq.filename}" dest="${deps.dir}"/>
163 <unzip src="${deps.dir}/${junit.filename}" dest="${deps.dir}"/>
164 <unzip src="${deps.dir}/${jboss.filename}" dest="${jboss.home}/.."/>-->
167 <target name="install" depends="fetch-dependencies, install-solr" description="Installs the configuration files of the application server">
168 <!-- Install HornetQ configuration -->
169 <copy todir="${jboss.run_conf.lib.dir}">
170 <fileset dir="${hornetq.path}/lib">
171 <include name="hornetq-*.jar"/>
172 <include name="netty*.jar"/>
175 <property name="hornetq.sar.dir" value="${jboss.deploy.dir}/hornetq.sar"/>
176 <mkdir dir="${hornetq.sar.dir}"/>
177 <copy todir="${hornetq.sar.dir}">
178 <fileset dir="${hornetq.path}/config/jboss-as/non-clustered" includes="*" excludes="**/jboss-as-4/**"/>
180 <unzip src="${hornetq.path}/lib/hornetq-ra.rar" dest="${jboss.deploy.dir}/hornetq-ra.rar"/>
181 <delete dir="${jboss.deploy.dir}/messaging" failonerror="false"/>
182 <mkdir dir="${jboss.bin.dir}/META-INF/lib/linux2/x86"/>
183 <mkdir dir="${jboss.bin.dir}/META-INF/lib/linux2/x64"/>
184 <copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x86" file="${hornetq.path}/bin/libHornetQAIO32.so"/>
185 <copy todir="${jboss.bin.dir}/META-INF/lib/linux2/x64" file="${hornetq.path}/bin/libHornetQAIO64.so"/>
186 <!-- Install gss configuration -->
187 <copy todir="${jboss.bin.dir}" overwrite="true" failonerror="false">
188 <fileset dir="${jboss.project}/bin"/>
190 <copy todir="${jboss.bin.dir}" overwrite="true" failonerror="false">
191 <fileset dir="${jboss-spec.bin.dir}" />
193 <copy todir="${jboss.conf.dir}" overwrite="true" failonerror="false">
194 <fileset dir="${jboss.project}/conf"/>
196 <copy todir="${jboss.conf.dir}" overwrite="true" failonerror="false">
197 <fileset dir="${jboss-spec.conf.dir}"/>
199 <copy todir="${jboss.run_conf.lib.dir}" overwrite="true" failonerror="false">
200 <fileset dir="${jboss.project}/lib"/>
202 <copy todir="${jboss.run_conf.lib.dir}" overwrite="true" failonerror="false">
203 <fileset dir="${jboss-spec.lib.dir}" />
205 <copy todir="${jboss.deploy.dir}" overwrite="true" failonerror="false">
206 <fileset dir="${jboss.project}/deploy"/>
208 <copy todir="${jboss.deploy.dir}" overwrite="true" failonerror="false">
209 <fileset dir="${jboss-spec.deploy.dir}" />
211 <!-- Make run.sh executable again -->
212 <chmod file="${jboss.bin.dir}/run.sh" perm="ugo+x"/>
215 <target name="compile" description="Compile src to bin">
216 <mkdir dir="${build.dir}" />
217 <javac srcdir="${src.dir}:${test.dir}" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source" source="1.6">
218 <classpath refid="project.class.path" />
222 <target name="package-code" depends="compile" description="Package up the project code as a jar">
223 <jar destfile="${build.dir}/${ant.project.name}.jar">
225 <include name="org/json/**" />
226 <include name="**/client/AdminService.class" />
227 <include name="**/server/**" />
228 <exclude name="**/domain/**"/>
229 <exclude name="**/ejb/**"/>
232 <include name="**/*.xml" />
233 <include name="**/client/exceptions/**" />
238 <target name="package-webdav" depends="compile" description="Package up the webdav code as a jar">
239 <jar destfile="${build.dir}/webdav.jar">
241 <include name="**/webdav/**" />
246 <target name="package-ejb" depends="compile" description="Package up the EJB classes">
247 <jar destfile="${build.dir}/ejbs.jar">
248 <zipfileset dir="${basedir}/persistence" />
249 <zipfileset dir="${build.dir}">
250 <include name="**/configuration/**" />
251 <include name="**/exceptions/**" />
252 <include name="**/domain/**" />
253 <include name="**/ejb/**" />
254 <exclude name="**/*Test.class"/>
259 <target name="check-gwt-compile" depends="compile">
260 <uptodate property="compilation-not-needed">
261 <srcfiles dir="${src.dir}" excludes="**/server/**"/>
262 <mergemapper to="${build.dir}/www/gr.ebs.gss.GSS.nocache.js"/>
266 <target name="gwt-compile" depends="check-gwt-compile" unless="compilation-not-needed" description="Compile client code to JavaScript">
267 <condition property="gwt-dev-lib" value="${gwt.path}/gwt-dev.jar">
268 <available file="${gwt.path}/gwt-dev.jar" />
271 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
272 <!--arg value="-style"/>
273 <arg value="DETAILED"/-->
274 <arg value="-localWorkers" />
275 <arg value="${gwt.workers}" />
277 <arg value="${gwt.www.dir}"/>
278 <arg value="${gwt.module}"/>
281 <pathelement path="${gwt-dev-lib}"/>
282 <path refid="project.class.path" />
283 <pathelement path="${src.dir}" />
286 <mkdir dir="${build.dir}/www"/>
287 <copy todir="${build.dir}/www">
288 <fileset dir="${gwt.www.dir}/${gwt.module}" excludes="**/${gwt.module.class}.html">
291 <copy file="${gwt.www.dir}/${gwt.module}/${gwt.module.class}.html" tofile="${build.dir}/www/index.html" />
294 <target name="package-war" depends="gwt-compile, package-code" description="Package up the web part as a war">
295 <jar destfile="${build.dir}/${dist.war}">
296 <zipfileset dir="${war.dir}" >
297 <exclude name="**/classes/**"/>
299 <zipfileset dir="${build.dir}/www" />
300 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
301 <include name="${ant.project.name}.jar" />
306 <target name="check-gwt-admin-compile" depends="compile">
307 <uptodate property="compilation-not-needed">
308 <srcfiles dir="${src.dir}" excludes="**/server/**"/>
309 <mergemapper to="${build.dir}/wwwadmin/gr.ebs.gss.admin.TwoAdmin.nocache.js"/>
313 <target name="gwt-admin-compile" depends="check-gwt-admin-compile" unless="compilation-not-needed" description="Compile client code to JavaScript">
314 <condition property="gwt-dev-lib" value="${gwt.path}/gwt-dev.jar">
315 <available file="${gwt.path}/gwt-dev.jar" />
318 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
319 <!--arg value="-style"/>
320 <arg value="DETAILED"/-->
321 <arg value="-localWorkers" />
322 <arg value="${gwt.workers}" />
324 <arg value="${gwt.www.admin.dir}"/>
325 <arg value="${gwt.admin.module}"/>
326 <jvmarg value="-Xmx128m"/>
328 <pathelement path="${gwt-dev-lib}"/>
329 <path refid="project.class.path" />
330 <pathelement path="${src.dir}" />
333 <mkdir dir="${build.dir}/wwwadmin"/>
334 <copy todir="${build.dir}/wwwadmin">
335 <fileset dir="${gwt.www.admin.dir}/${gwt.admin.module}" excludes="**/${gwt.admin.module.class}.html">
338 <copy file="${gwt.www.admin.dir}/${gwt.admin.module}/${gwt.admin.module.class}.html" tofile="${build.dir}/wwwadmin/index.html" />
341 <target name="package-admin-war" depends="gwt-admin-compile, package-code" description="Package up the web part as a war">
342 <jar destfile="${build.dir}/${dist.admin.war}">
343 <zipfileset dir="${war.admin.dir}" >
344 <exclude name="**/classes/**"/>
346 <zipfileset dir="${build.dir}/wwwadmin" />
347 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
348 <include name="${ant.project.name}.jar" />
350 <zipfileset dir="${gwt.path}" prefix="WEB-INF/lib">
351 <include name="gwt-servlet.jar" />
356 <target name="package-webdav-war" depends="package-webdav" description="Package up the WebDAV part as a war">
357 <jar destfile="${build.dir}/${webdav.war}">
358 <zipfileset dir="${webdav.war.dir}" />
359 <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
360 <include name="webdav.jar" />
365 <target name="package-mbeans" depends="compile">
366 <jar jarfile="${build.dir}/${mbeans.dist.file}" basedir="${build.dir}">
367 <include name="**/mbeans/**"/>
368 <metainf dir="${mbeans.meta-inf.dir}"/>
372 <target name="package-ear" depends=" package-war, package-webdav-war, package-ejb, package-mbeans" description="Package up the project as an ear">
373 <jar destfile="${build.dir}/${dist.ear}">
374 <zipfileset dir="${ear.dir}" />
375 <zipfileset dir="${build.dir}" >
376 <include name="ejbs.jar" />
377 <include name="${dist.war}" />
378 <include name="${webdav.war}" />
380 <include name="${mbeans.dist.file}"/>
382 <zipfileset dir="${solr.dist}" prefix="lib">
383 <include name="${solrj.jar}" />
388 <target name="deploy" depends="package-ear" description="Deploy the project to the server">
389 <copy todir="${jboss.deploy.dir}" file="${build.dir}/${dist.ear}"/>
392 <target name="redeploy" depends="package-ear" description="Redeploy the project to the server">
393 <copy todir="${jboss.deploy.dir}" file="${build.dir}/${dist.ear}" overwrite="yes"/>
396 <target name="undeploy" description="Undeploy the project from the server">
397 <delete file="${jboss.deploy.dir}/${dist.ear}"/>
400 <target name="clean" description="Delete the contents of the bin and www directories">
401 <delete dir="${build.dir}"/>
402 <delete dir="${gwt.www.dir}"/>
403 <delete dir="${gwt.www.admin.dir}"/>
406 <target name="deinstall"
407 description="Delete the contents of the JBoss home directory">
408 <delete dir="${jboss.home}"/>
411 <target name="distclean" depends="deinstall, clean"
412 description="Delete the contents of the JBoss home directory and all downloaded artifacts">
413 <delete dir="${deps.dir}"/>
416 <target name="test" description="Performs unit tests on the project" depends="compile">
418 property="junit.present"
419 classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
420 classpathref="project.class.path"/>
421 <fail unless="junit.present">
422 ##################################################################
424 Please make sure junit.jar is in ANT_HOME/lib, or made available
425 to Ant using other mechanisms like -lib or CLASSPATH.
426 ##################################################################
429 <junit printsummary="withOutAndErr" fork="yes" haltonfailure="yes">
430 <classpath refid="project.class.path"/>
431 <formatter type="plain"/>
432 <batchtest todir="${test.build.dir}">
433 <fileset dir="${test.build.classes.dir}">
434 <include name="**/*Test.class"/>
441 <target name="run" description="Starts the server" depends="deploy">
442 <exec executable="${jboss.bin.dir}/run.sh" osfamily="unix">
443 <arg line="${jboss.args}"/>
445 <exec executable="cmd" osfamily="windows">
447 <arg value="${jboss.bin.dir}/run.bat"/>
448 <arg line="${jboss.args}"/>
452 <target name="check-solr">
453 <available file="${solr.root}" type="dir" property="solr.home.present"/>
456 <target name="fetch-solr" unless="solr.home.present" depends="check-solr">
457 <get src="${solr.download.url}" dest="${deps.dir}/${solr.filename}" usetimestamp="true"/>
458 <unzip src="${deps.dir}/${solr.filename}" dest="${deps.dir}"/>
461 <target name="compile-solr" depends="fetch-solr">
462 <mkdir dir="${build.dir}"/>
463 <javac srcdir="${solr.src.dir}" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source" source="1.6">
464 <classpath refid="project.class.path" />
468 <target name="install-solr" depends="fetch-solr, compile-solr">
469 <copy todir="${solr.conf.dir}" overwrite="true" failonerror="false">
470 <fileset dir="${solr-spec.conf.dir}" />
472 <jar destfile="${solr.root}/greektokenfilter.jar">
473 <fileset dir="${build.dir}">
474 <include name="gr/ebs/gss/solr/analysis/GreekLowerCaseFilterFactory.class"/>
479 <target name="run-solr" depends="install-solr">
480 <java jar="${solr.root}/example/start.jar" fork="true" dir="${solr.root}/example"/>