~francesc.busquets/jclic/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<?xml version="1.0"?>
<project name="JClic" basedir="." default="all">

  <!-- =================================================================== -->
  <!-- INIT                                                                -->
  <!-- =================================================================== -->
  <target name="init" 
          description="Initialize variables and define patterns and filters.">  

    <!-- Variables -->
    <property name="name"           value="JClic" />    
    <property name="year"           value="2004-17" />
    
    <!-- Set the appropiate values for your certificate keys here,
         or write them on a text file called ".ant-global.properties",
         placed in your home directory, using the form "variable=value" -->
    <property file="${user.home}/.ant-global.properties" />
    <property name="author" value="Test" />
    <!-- Check the Java system to determine the appropiate
         keystore format: Sun JKS (default) or GNU GKR -->
    <condition property="keystore.format" value="-gkr" else="">
      <contains string="${java.vm.name}" substring="gcj" casesensitive="false" />
    </condition>
    <property name="keystore.dir" location="keystore" />    
    <property name="keystore.file" value="testcert${keystore.format}.keystore" />
    <property name="keystore.alias" value="testcert" />
    <property name="keystore.storepass" value="passwd" />
    <property name="keystore.keypass" value="passwd" />
    <property name="keystore.storetype" value="JKS" />

    <property name="src.dir"          location="src" />
    <property name="ext.dir"          location="extensions" />
    <property name="lib.dir"          location="lib" />
    <property name="build.dir"        location="build" />
    <property name="dist.dir"         location="dist" />
    <property name="dist.jclic.dir"   location="${dist.dir}/jclic" />
    <property name="dist.reports.dir" location="${dist.dir}/reports" />
    <property name="deploy.dir"       location="deploy" />
    <property name="apidoc.dir"       location="apidoc" />

    <property name="resource.path"    value="edu/xtec/resources" />
    
    <!-- JClic is currently targeted to JVM 1.7 -->
    <property name="javac.source" value="1.7"/>
    <property name="javac.target" value="1.7"/>

    <!-- Check if "rt.jar" exists in lib/bootstrap/1.7  -->
    <property name="bootstrap.file" value="${lib.dir}/bootstrap/${javac.target}/rt.jar"/>
    <condition property="bootstrap.path"
               value="${bootstrap.file}"
               else="${java.home}/lib/rt.jar">
       <available file="${bootstrap.file}"/>      
    </condition>
    <property name="bootstrap.arg" value="-Xbootclasspath:${bootstrap.path}"/>
    
    <!-- Other compiler options -->
    <property name="debug"          value="on" />    
    <property name="deprecation"    value="off" />    
    <property name="optimize"       value="on" />
    <property name="encoding"       value="UTF-8" />

    <!-- Custom javac definition -->
    <presetdef name="ext.javac">
        <javac debug="${debug}"
               deprecation="${deprecation}" 
               optimize="${optimize}"
               encoding="${encoding}"
               source="${javac.source}"
               target="${javac.target}"
               bootclasspath="${bootstrap.path}"
               includeAntRuntime="false" >
               <compilerarg value="-Xlint:unchecked"/>
               <compilerarg value="${bootstrap.arg}" />
        </javac>
    </presetdef>
    
    <!-- Custom javac definition - without warnings about generics -->
    <presetdef name="ext.javac.nogenerics">
        <javac debug="${debug}"
               deprecation="${deprecation}" 
               optimize="${optimize}"
               encoding="${encoding}"
               source="${javac.source}"
               target="${javac.target}"
               bootclasspath="${bootstrap.path}"
               includeAntRuntime="false" >
               <compilerarg value="${bootstrap.arg}" />
        </javac>
    </presetdef>

    <!-- Patterns -->
    <patternset id="images" >
        <include name="**/*.gif"/>
        <include name="**/*.jpg"/>
        <include name="**/*.png"/>
        <include name="**/*.ttf"/>
        <include name="**/*.ico"/>
    </patternset>
    <patternset id="sounds" >
        <include name="**/*.wav"/>
        <include name="**/*.mp3"/>
        <include name="**/*.au"/>
        <include name="**/*.aif"/>
        <include name="**/*.ogg"/>
    </patternset>    
    <patternset id="docs" >
        <include name="**/*.html"/>
        <include name="**/*.xml"/>
        <include name="**/*.css"/>
    </patternset>    
    <patternset id="xmls" >
        <include name="**/*.xml"/>
    </patternset>    
    <patternset id="props" >
        <include name="**/*.properties"/>
    </patternset>
    <patternset id="serialized" >
        <include name="**/*.ser"/>
    </patternset>
    <patternset id="spi.services" >
        <include name="META-INF/services/javax.sound.sampled.spi.*"/>
        <include name="META-INF/services/javax.sound.midi.spi.*"/>
    </patternset>    

    <!-- Filters -->
    <filterset id="versionFilterSet">
        <filtersfile file="project.properties"/>
    </filterset>

    <!-- Display info -->
    <echo message="---------------------"/>
    <echo message="JClic build"/>
    <echo message="---------------------"/>        
    <echo message="Using ${ant.version}, in ${ant.home}"/>
    <echo message="Using Java ${java.version} by ${java.vendor} in ${java.home}"/>
    <echo message="Generating code for Java ${javac.target}"/>
    <echo message="Bootstrap: ${bootstrap.path}"/>
        
    <!-- Create dirs -->
    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${build.dir}"/>
  </target>

  <!-- =================================================================== -->
  <!-- MAIN                                                                -->
  <!-- =================================================================== -->
  <target name="all" 
          depends="dist" 
          description="Builds JClic JAR files">
    <echo message="*** JClic has been successfully compiled!"/>
    <echo message="Unsigned JAR files have been created in: ${dist.jclic.dir}"/>
    <echo message="Run 'ant sign' to digitally sign the JAR files"/>
    <echo message="Run 'ant webapp' to build the WAR and EAR files needed to run JClicReports as a servlet"/>
    <echo message="Run 'ant javadoc' to build the JClic API docs"/>
  </target>

  <!-- =================================================================== -->
  <!-- DIST                                                               -->
  <!-- =================================================================== -->
  <target name="dist" 
          depends="jclicplayer,jclicauthor,jclicreports" 
          description="Prepare distribution">
  
    <!-- Workaround to avoid "Modified in the future" warnings -->
    <sleep seconds="2" />
    <mkdir dir="${dist.jclic.dir}"/>
    <copy todir="${dist.jclic.dir}">
        <fileset dir="${build.dir}" includes="*.jar" />
    </copy>        
  </target>

  <!-- =================================================================== -->
  <!-- SIGN                                                               -->
  <!-- =================================================================== -->
  <target name="sign" 
          depends="sign.with.tsa" 
          unless="keystore.tsa"
          description="Digital signature of the JAR files, without TSA">
  
    <echo message="Signing with key &quot;${keystore.alias}&quot; in ${keystore.dir}/${keystore.file}"/>

    <!-- Signing the .jar files with ${keystore.dir}/${keystore.file}"  -->
    <!-- See keystore/readme.txt -->
    <signjar keystore="${keystore.dir}/${keystore.file}"
             alias="${keystore.alias}" 
             storepass="${keystore.storepass}"
             storetype="${keystore.storetype}"
             keypass="${keystore.keypass}"
             lazy="true">
        <fileset dir="${dist.jclic.dir}" includes="*.jar" />
    </signjar>

    <echo message="*** JClic files have been digitally signed with &quot;${keystore.alias}&quot;"/>
    <echo message="Signed JAR files are located in: ${dist.jclic.dir}"/>

  </target>

  <target name="sign.with.tsa" 
          depends="dist" 
          if="keystore.tsa"
          description="Digital signature of the JAR files using a TSA URL">

    <echo message="Signing with key &quot;${keystore.alias}&quot; in ${keystore.dir}/${keystore.file}"/>
    <signjar keystore="${keystore.dir}/${keystore.file}"
             alias="${keystore.alias}" 
             storepass="${keystore.storepass}"
             storetype="${keystore.storetype}"
             keypass="${keystore.keypass}"
             tsaurl="${keystore.tsa}"
             lazy="true">
        <fileset dir="${dist.jclic.dir}" includes="*.jar" />
    </signjar>
    <echo message="*** JClic files have been digitally signed with &quot;${keystore.alias}&quot;"/>
    <echo message="Signed JAR files are located in: ${dist.jclic.dir}"/>
  </target>

  <!-- =================================================================== -->
  <!-- CLEAN                                                               -->
  <!-- =================================================================== -->
  <target name="clean" 
          depends="init" 
          description="Clean build dir">
    <delete dir="${build.dir}" />
    <echo message="*** Build dir cleared!"/>
  </target>
  
  <!-- =================================================================== -->
  <!-- LAUNCH PLAYER                                                       -->
  <!-- =================================================================== -->
  <target name="launchPlayer" 
          depends="jclicplayer,dist" 
          description="Launch JClic player">
    <echo message="Launching JClicPlayer..."/>
    <java jar="${dist.jclic.dir}/jclic.jar" fork="true" />
    <echo message="JClicPlayer finished"/>
  </target>

  <!-- =================================================================== -->
  <!-- LAUNCH AUTHOR                                                       -->
  <!-- =================================================================== -->
  <target name="launchAuthor" 
          depends="jclicauthor,dist" 
          description="Launch JClic author">
    <echo message="Launching JClicAuthor..."/>
    <java jar="${dist.jclic.dir}/jclicauthor.jar" fork="true" />
    <echo message="JClicAuthor finished"/>
  </target>

  <!-- =================================================================== -->
  <!-- LAUNCH REPORTS SERVER                                               -->
  <!-- =================================================================== -->
  <target name="launchReports" 
          depends="jclicreports,dist" 
          description="Launch JClic reports server">
    <echo message="Launching JClic reports server..."/>
    <java jar="${dist.jclic.dir}/jclicreports.jar" fork="true" />
    <echo message="JClic reports server finished"/>
  </target>

  <!-- =================================================================== -->
  <!-- JAVADOC                                                             -->
  <!-- =================================================================== -->
  <target name="javadoc" 
          depends="all" 
          description="Generate JClic JavaDoc">
    <delete dir="${apidoc.dir}" />
    <mkdir dir="${apidoc.dir}"/>
    <javadoc packagenames="edu.xtec.*" 
             destdir="${apidoc.dir}" 
             author="true" 
             version="true" 
             use="true" 
             splitindex="true" 
             noindex="false" 
             windowtitle="${name} API" 
             doctitle="${name}">
             <bottom><![CDATA[<p>Copyright &#169; ${year} Francesc Busquets (<a href="mailto:fbusquets@xtec.cat">fbusquets@xtec.cat</a>) &amp; Departament d'Educaci&oacute; de la Generalitat de Catalunya (<a href="mailto:info@xtec.cat">info@xtec.cat</a>)<br>Licensed under the terms of the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.</p>]]></bottom>
             <sourcepath>
               <pathelement location="${src.dir}/core"/>
               <pathelement location="${src.dir}/author"/>
             </sourcepath>
             <classpath>
               <pathelement location="${build.dir}/jdom"/>
               <pathelement location="${build.dir}/jdom2"/>
               <pathelement location="${build.dir}/json"/>
               <pathelement location="${build.dir}/dbconn"/>
               <pathelement location="${build.dir}/soundspi"/>
               <pathelement location="${build.dir}/image4j"/>
               <pathelement location="${build.dir}/lib/jmf-api"/>
               <pathelement location="${build.dir}/lib/qtjava-api"/>                
             </classpath>
             <excludepackage name="edu.xtec.resources.messages" />
             <group title="Activities"
                    packages="edu.xtec.jclic.activities*" />
             <group title="Automation"
                    packages="edu.xtec.jclic.automation*" />
             <group title="Report system" >
                    <package name="edu.xtec.jclic.report*"/>
             </group>
             <group title="Utilities" >
                    <package name="edu.xtec.util*"/>
                    <package name="edu.xtec.jclic.misc*"/>
                    <package name="edu.xtec.jclic.beans*" />
             </group>
             <group title="Core" >
                    <package name="edu.xtec.jclic*"/>
             </group>
             
             <link href="http://docs.oracle.com/javase/7/docs/api/" />
             <link href="http://docs.oracle.com/cd/E17802_01/j2se/javase/technologies/desktop/media/jmf/2.1.1/apidocs/" />
             <link href="http://www.jdom.org/docs/apidocs.1.1/" />
             <link href="http://image4j.sourceforge.net/javadoc/" />
    </javadoc>

    <echo message="*** JClic API documentation has been created in: ${apidoc.dir}"/>

  </target>

  <!-- =================================================================== -->
  <!-- JDOM (was JCLICXML)                                                 -->
  <!-- =================================================================== -->
  <target name="jdom" 
          depends="init"
          description="Builds the JDOM library">
    <mkdir dir="${build.dir}/jdom"/>

    <!-- Compilation of JDOM 1.0 without XPATH-->
    <ext.javac.nogenerics destdir="${build.dir}/jdom" >
           <src path="${ext.dir}/xml/jdom-1.0/src" />
           <src path="${ext.dir}/xml/customJdom-1.0/src" />
           <exclude name="org/jdom/xpath/**/*"/>
    </ext.javac.nogenerics>
  </target>
    
  <!-- =================================================================== -->
  <!-- JSON                                                              -->
  <!-- =================================================================== -->
  <target name="json" 
          depends="init"
          description="Builds the JSON-Java library">
    <mkdir dir="${build.dir}/json"/>
    <ext.javac.nogenerics srcdir="${ext.dir}/json/src" 
               destdir="${build.dir}/json" />
  </target>

  <!-- =================================================================== -->
  <!-- DBCONN                                                              -->
  <!-- =================================================================== -->
  <target name="dbconn" 
          depends="init"
          description="Builds a database connection pool interface">
    <mkdir dir="${build.dir}/dbconn"/>
    <ext.javac srcdir="${ext.dir}/dbconn/src" 
               destdir="${build.dir}/dbconn" />
  </target>
  
  <!-- =================================================================== -->
  <!-- SOUNDSPI                                                            -->
  <!-- =================================================================== -->
  <target name="soundspi" 
          depends="init"
          description="Builds the sound library">
    <mkdir dir="${build.dir}/soundspi"/>
    <ext.javac.nogenerics destdir="${build.dir}/soundspi" >
        <src path="${ext.dir}/soundspi/tritonus/src" />
        <src path="${ext.dir}/soundspi/javalayer/src" />
        <src path="${ext.dir}/soundspi/MpegAudioSPI/src" />
        <src path="${ext.dir}/soundspi/jorbis/src" />      
    </ext.javac.nogenerics>
    <copy todir="${build.dir}/soundspi">
        <fileset dir="${ext.dir}/soundspi/javalayer/src">
            <patternset refid="serialized" />
        </fileset>            
        <fileset dir="${ext.dir}/soundspi/catalog">
            <patternset refid="spi.services" />
        </fileset>            
    </copy>
  </target>  
  
  <!-- =================================================================== -->
  <!-- IMAGE4J                                                             -->
  <!-- =================================================================== -->
  <target name="image4j" 
          depends="init"
          description="Builds the image4j library">
    <mkdir dir="${build.dir}/image4j"/>
    <ext.javac srcdir="${ext.dir}/img/image4j/src" 
               destdir="${build.dir}/image4j" />
  </target>

  <!-- =================================================================== -->
  <!-- JMF-API                                                             -->
  <!-- =================================================================== -->
  <target name="jmf-api"
          depends="init"
          description="Builds an empty interface for Java Media Framework">
    <mkdir dir="${build.dir}/lib/jmf-api"/>
    <ext.javac srcdir="${lib.dir}/jmf-api/src" 
               destdir="${build.dir}/lib/jmf-api" />
  </target>
  
  <!-- =================================================================== -->
  <!-- QTJAVA-API                                                          -->
  <!-- =================================================================== -->
  <target name="qtjava-api"
          depends="init"
          description="Builds an empty interface for QuickTime forJava 6.1">
    <mkdir dir="${build.dir}/lib/qtjava-api"/>
    <ext.javac srcdir="${lib.dir}/qtjava-api/src" 
               destdir="${build.dir}/lib/qtjava-api" />
  </target>
        
  
  <!-- =================================================================== -->
  <!-- CORE                                                                -->
  <!-- =================================================================== -->
  <target name="core" 
          depends="jdom,image4j,soundspi,jmf-api,qtjava-api,dbconn,json"
          description="Builds the main component of JClic">
    <mkdir dir="${build.dir}/jclic"/>

    <mkdir dir="${build.dir}/jclic/${resource.path}"/>    
    <copy todir="${build.dir}/jclic/${resource.path}">
        <filterset refid="versionFilterSet"/>
        <fileset dir="${src.dir}/core/${resource.path}">
            <patternset refid="props" />
        </fileset>            
    </copy>
    <copy todir="${build.dir}/jclic/${resource.path}">
        <fileset dir="${src.dir}/core/${resource.path}">
            <patternset refid="images" />
            <patternset refid="sounds" />
            <patternset refid="docs" />
        </fileset>            
    </copy>

    <ext.javac destdir="${build.dir}/jclic" >
        <src path="${src.dir}/core" />
        <classpath>
            <pathelement location="${build.dir}/jdom"/>
            <pathelement location="${build.dir}/json"/>
            <pathelement location="${build.dir}/dbconn"/>
            <pathelement location="${build.dir}/image4j"/>
            <pathelement location="${build.dir}/lib/jmf-api"/>
            <pathelement location="${build.dir}/lib/qtjava-api"/>
            <pathelement location="${build.dir}/soundspi"/>
        </classpath>
    </ext.javac>
  </target>

  <!-- =================================================================== -->
  <!-- JCLIC PLAYER                                                        -->
  <!-- =================================================================== -->
  <target name="jclicplayer" 
          depends="core"
          description="Builds the jclic.jar component">

    <mkdir dir="${build.dir}/jclicPlayer"/>
    <mkdir dir="${build.dir}/jclicPlayer/${resource.path}"/>

    <jar jarfile="${build.dir}/jclic.jar">
        <manifest>
            <attribute name="Built-By" 
                       value="${user.name}"/>
            <attribute name="Main-Class" 
                       value="JClicPlayer"/>
            <attribute name="Class-Path" 
                       value="."/>
            <attribute name="Permissions" 
                       value="all-permissions"/>
            <attribute name="Codebase" 
                       value="*"/>
            <attribute name="Application-Name" 
                       value="JClic"/>
        </manifest>
         <fileset dir="${build.dir}/jclic" />
         <fileset dir="${build.dir}/jdom" />
         <fileset dir="${build.dir}/json" />
         <fileset dir="${build.dir}/dbconn" />         
         <fileset dir="${build.dir}/soundspi" />
         <fileset dir="${build.dir}/image4j" />
    </jar>
  </target>  
    
  <!-- =================================================================== -->
  <!-- JCLICAUTHOR                                                         -->
  <!-- =================================================================== -->
  <target name="jclicauthor" 
          depends="jclicplayer"
          description="Builds the jclicauthor.jar component">
    <mkdir dir="${build.dir}/author"/>
    <mkdir dir="${build.dir}/author/${resource.path}"/>
    <copy todir="${build.dir}/author/${resource.path}">
        <fileset dir="${src.dir}/author/${resource.path}">
            <patternset refid="images" />
            <patternset refid="sounds" />
            <patternset refid="docs" />
        </fileset>            
    </copy>        
    <copy todir="${build.dir}/author/${resource.path}">
        <filterset refid="versionFilterSet"/>
        <fileset dir="${src.dir}/author/${resource.path}">
            <patternset refid="props" />
        </fileset>            
    </copy>    

    <ext.javac destdir="${build.dir}/author" >
        <src path="${src.dir}/author"/>
        <classpath>
            <pathelement location="${build.dir}/jclic.jar"/>
        </classpath>
    </ext.javac>

    <jar jarfile="${build.dir}/jclicauthor.jar">
        <manifest>
            <attribute name="Built-By" 
                       value="${user.name}"/>
            <attribute name="Main-Class" 
                       value="JClicAuthor"/>
            <attribute name="Class-Path" 
                       value=". jclic.jar"/>
            <attribute name="Permissions" 
                       value="all-permissions"/>
            <attribute name="Codebase" 
                       value="*"/>
            <attribute name="Application-Name" 
                       value="JClic Author"/>
        </manifest>
        <fileset dir="${build.dir}/author" />
    </jar>
  </target>
    
  <!-- =================================================================== -->
  <!-- SERVLET API                                                         -->
  <!-- =================================================================== -->
  <target name="servlet-api"
          depends="init"
          description="Builds the servlet API">
    <mkdir dir="${build.dir}/lib/servlet-api"/>
    <ext.javac srcdir="${lib.dir}/servlet-api/src" 
               destdir="${build.dir}/lib/servlet-api" />
  </target>

  <!-- =================================================================== -->
  <!-- JCLIC REPORTS                                                        -->
  <!-- =================================================================== -->
  <target name="jclicreports" 
          depends="core,servlet-api"
          description="Builds the autonomous JClic reports server">
    <mkdir dir="${build.dir}/jclicreports"/>
    <copy todir="${build.dir}/jclicreports">
        <fileset dir="${src.dir}/report/reportServer">
            <patternset refid="images" />
            <patternset refid="docs" />
        </fileset>            
        <fileset dir="${src.dir}/report/reportServlets">
            <patternset refid="images" />
            <patternset refid="docs" />
            <patternset refid="props" />
        </fileset>            
    </copy>        
    <copy todir="${build.dir}/jclicreports">
        <filterset refid="versionFilterSet"/>
        <fileset dir="${src.dir}/report/reportServer">
            <patternset refid="props" />
        </fileset>            
    </copy>        

    <ext.javac destdir="${build.dir}/jclicreports" >
        <src path="${src.dir}/report/reportServer"/>
        <src path="${src.dir}/report/reportServlets"/>
        <classpath>
            <pathelement location="${build.dir}/jclic"/>
            <pathelement location="${build.dir}/lib/servlet-api"/>
            <pathelement location="${build.dir}/jdom"/>
            <pathelement location="${build.dir}/dbconn"/>
        </classpath>
    </ext.javac>

    <jar jarfile="${build.dir}/jclicreports.jar">
        <manifest>
            <attribute name="Built-By" 
                       value="${user.name}"/>
            <attribute name="Main-Class" 
                       value="ReportServer"/>
            <attribute name="Class-Path" 
                       value=". jclic.jar"/>
            <attribute name="Permissions" 
                       value="all-permissions"/>
            <attribute name="Codebase" 
                       value="*"/>
            <attribute name="Application-Name" 
                       value="JClic Reports"/>
        </manifest>
        <fileset dir="${build.dir}/jclicreports" />
    </jar>
  </target>

  <!-- =================================================================== -->
  <!-- JCLIC REPORTS WEB APP                                               -->
  <!-- =================================================================== -->
  <target name="webapp" 
          depends="jclicreports"
          description="Builds the WAR and EAR versions of the JClic reports server, suitable for Tomcat or other J2EE application server">
    <mkdir dir="${dist.reports.dir}"/>
    <mkdir dir="${build.dir}/webapp/WEB-INF/classes"/>
    <copy todir="${build.dir}/webapp">
        <fileset dir="${src.dir}/report/reportServlets/edu/xtec/resources/html">
            <patternset refid="images" />
            <patternset refid="docs" />
        </fileset>
    </copy> 
    <copy file="${src.dir}/report/webApp/index.html" todir="${build.dir}/webapp"/>    

    <ext.javac destdir="${build.dir}/webapp/WEB-INF/classes" >
        <src path="${src.dir}/report/webApp/WEB-INF/classes"/>
        <classpath>
            <pathelement location="${build.dir}/jclicreports.jar"/>
            <pathelement location="${build.dir}/jclic.jar"/>
            <pathelement location="${build.dir}/lib/servlet-api"/>
        </classpath>
    </ext.javac>

    <!-- workaround to avoid the 2-seconds granularity value set by the "war" ant task (see ant's manual)-->
    <sleep seconds="3" />    
    <war destfile="${dist.reports.dir}/jclicreports.war" 
         basedir="${build.dir}/webapp"
         webxml="${src.dir}/report/webApp/WEB-INF/web.xml" >
        <manifest>
            <attribute name="Built-By" 
                       value="${user.name}"/>
        </manifest>
        <lib dir="${build.dir}">
            <include name="jclicreports.jar" />
            <include name="jclic.jar" />
        </lib>
    </war>
    <sleep seconds="3" />    
    <ear destfile="${dist.reports.dir}/jclicreports.ear" 
         appxml="${deploy.dir}/reports/xml/application.xml">
        <manifest>
            <attribute name="Built-By" 
                       value="${user.name}"/>
        </manifest>
        <fileset dir="${dist.reports.dir}" includes="*.war"/>
    </ear>

    <echo message="*** JClic WAR and EAR files have been created in: ${dist.reports.dir}"/>

  </target>

</project>