~ubuntu-branches/ubuntu/jaunty/ant/jaunty-proposed

« back to all changes in this revision

Viewing changes to docs/faq.html

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Gybas
  • Date: 2002-02-14 14:28:48 UTC
  • Revision ID: james.westby@ubuntu.com-20020214142848-2ww7ynmqkj31vlmn
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
 
 
3
<!-- Content Stylesheet for Site -->
 
4
 
 
5
        
 
6
<!-- start the processing -->
 
7
    <html>
 
8
    <head>
 
9
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
 
10
  
 
11
                      <meta name="author" value="Stefan Bodewig">
 
12
  <meta name="email" value="bodewig@apache.org">
 
13
        
 
14
      <title>The Jakarta Site - Frequently Asked Questions</title>
 
15
    </head>
 
16
  
 
17
    <body bgcolor="#ffffff" text="#000000" link="#525D76">    
 
18
      <table border="0" width="100%" cellspacing="0">
 
19
        <!-- TOP IMAGE -->
 
20
        <tr>
 
21
                <td colspan="2">
 
22
    <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" align="left" border="0"/></a>
 
23
    </td>
 
24
          </tr>
 
25
      </table>
 
26
      <table border="0" width="100%" cellspacing="4">
 
27
        <tr><td colspan="2">
 
28
          <hr noshade="" size="1"/>
 
29
        </td></tr>
 
30
        
 
31
        <tr>
 
32
          <!-- LEFT SIDE NAVIGATION -->
 
33
          <td valign="top" nowrap="true">
 
34
                <p><strong>Ant</strong></p>
 
35
    <ul>
 
36
          <li>      <a href="./index.html">Front Page</a>
 
37
  </li>
 
38
          <li>      <a href="./antnews.html">News</a>
 
39
  </li>
 
40
          <li>      <a href="./manual/index.html">Documentation</a>
 
41
  </li>
 
42
          <li>      <a href="./external.html">External Tools and Tasks</a>
 
43
  </li>
 
44
          <li>      <a href="./resources.html">Resources</a>
 
45
  </li>
 
46
          <li>      <a href="./faq.html">Ant FAQ</a>
 
47
  </li>
 
48
          <li>      <a href="./problems.html">Having Problems?</a>
 
49
  </li>
 
50
        </ul>
 
51
      <p><strong>Download</strong></p>
 
52
    <ul>
 
53
          <li>      <a href="http://jakarta.apache.org/site/binindex.html">Binaries</a>
 
54
  </li>
 
55
          <li>      <a href="http://jakarta.apache.org/site/sourceindex.html">Source Code</a>
 
56
  </li>
 
57
        </ul>
 
58
      <p><strong>Jakarta</strong></p>
 
59
    <ul>
 
60
          <li>      <a href="http://jakarta.apache.org/site/news.html">News & Status</a>
 
61
  </li>
 
62
          <li>      <a href="http://jakarta.apache.org/site/mission.html">Mission</a>
 
63
  </li>
 
64
          <li>      <a href="http://jakarta.apache.org/site/guidelines.html">Guidelines Notes</a>
 
65
  </li>
 
66
          <li>      <a href="http://jakarta.apache.org/site/faqs.html">FAQs</a>
 
67
  </li>
 
68
        </ul>
 
69
      <p><strong>Get Involved</strong></p>
 
70
    <ul>
 
71
          <li>      <a href="http://jakarta.apache.org/site/getinvolved.html">Overview</a>
 
72
  </li>
 
73
          <li>      <a href="http://jakarta.apache.org/site/cvsindex.html">CVS Repositories</a>
 
74
  </li>
 
75
          <li>      <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
 
76
  </li>
 
77
          <li>      <a href="http://jakarta.apache.org/site/library.html">Reference Library</a>
 
78
  </li>
 
79
          <li>      <a href="http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Ant">Bug Database</a>
 
80
  </li>
 
81
          <li>      <a href="http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Ant&bug_severity=Enhancement">Enhancement Requests</a>
 
82
  </li>
 
83
        </ul>
 
84
            </td>
 
85
          <td align="left" valign="top">
 
86
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
87
    <tr><td bgcolor="#525D76">
 
88
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
89
        <strong>Questions</strong>
 
90
      </font>
 
91
    </td></tr>
 
92
    <tr><td>
 
93
      <blockquote>
 
94
                      <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
95
    <tr><td bgcolor="#828DA6">
 
96
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
97
        <strong>General</strong>
 
98
      </font>
 
99
    </td></tr>
 
100
    <tr><td>
 
101
      <blockquote>
 
102
        <ul>
 
103
                    <li><a href="#what-is-ant">
 
104
  What is Ant?
 
105
  </a></li>
 
106
                    <li><a href="#ant-name">
 
107
  Why do you call it Ant?
 
108
  </a></li>
 
109
                    <li><a href="#history">
 
110
  Tell us a little bit about Ant's history.
 
111
  </a></li>
 
112
                </ul>
 
113
      </blockquote>
 
114
    </td></tr>
 
115
  </table>
 
116
                <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
117
    <tr><td bgcolor="#828DA6">
 
118
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
119
        <strong>Installation</strong>
 
120
      </font>
 
121
    </td></tr>
 
122
    <tr><td>
 
123
      <blockquote>
 
124
        <ul>
 
125
                    <li><a href="#no-gnu-tar">
 
126
  I get checksum errors when I try to extract the
 
127
      <code>tar.gz</code> distribution file. Why?
 
128
  </a></li>
 
129
                </ul>
 
130
      </blockquote>
 
131
    </td></tr>
 
132
  </table>
 
133
                <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
134
    <tr><td bgcolor="#828DA6">
 
135
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
136
        <strong>Using Ant</strong>
 
137
      </font>
 
138
    </td></tr>
 
139
    <tr><td>
 
140
      <blockquote>
 
141
        <ul>
 
142
                    <li><a href="#always-recompiles">
 
143
  Why does Ant always recompile all my Java files?
 
144
  </a></li>
 
145
                    <li><a href="#passing-cli-args">
 
146
  How do I pass parameters from the command line to my
 
147
        build file?
 
148
  </a></li>
 
149
                    <li><a href="#jikes-switches">
 
150
  How can I use Jikes specific command line
 
151
        switches?
 
152
  </a></li>
 
153
                    <li><a href="#shell-redirect-1">
 
154
  How do I include a &lt; character in my command line arguments?
 
155
  </a></li>
 
156
                    <li><a href="#shell-redirect-2">
 
157
  How do I redirect standard input or standard output
 
158
        in the <code>&lt;exec&gt;</code> task?
 
159
  </a></li>
 
160
                </ul>
 
161
      </blockquote>
 
162
    </td></tr>
 
163
  </table>
 
164
                <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
165
    <tr><td bgcolor="#828DA6">
 
166
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
167
        <strong>Ant and IDEs/Editors</strong>
 
168
      </font>
 
169
    </td></tr>
 
170
    <tr><td>
 
171
      <blockquote>
 
172
        <ul>
 
173
                    <li><a href="#integration">
 
174
  Is Ant supported by my IDE/Editor?
 
175
  </a></li>
 
176
                    <li><a href="#emacs-mode">
 
177
  Why doesn't (X)Emacs/vi/MacOS X's project builder
 
178
      parse the error messages generated by Ant correctly?
 
179
  </a></li>
 
180
                </ul>
 
181
      </blockquote>
 
182
    </td></tr>
 
183
  </table>
 
184
                <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
185
    <tr><td bgcolor="#828DA6">
 
186
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
187
        <strong>Advanced issues</strong>
 
188
      </font>
 
189
    </td></tr>
 
190
    <tr><td>
 
191
      <blockquote>
 
192
        <ul>
 
193
                    <li><a href="#dtd">
 
194
  Is there a DTD that I can use to validate my build
 
195
      files?
 
196
  </a></li>
 
197
                    <li><a href="#xml-entity-include">
 
198
  How do I include an XML snippet in my build file?
 
199
  </a></li>
 
200
                    <li><a href="#mail-logger">
 
201
  How do I send an email with the result of my build
 
202
        process?
 
203
  </a></li>
 
204
                </ul>
 
205
      </blockquote>
 
206
    </td></tr>
 
207
  </table>
 
208
                <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
209
    <tr><td bgcolor="#828DA6">
 
210
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
211
        <strong>Known problems</strong>
 
212
      </font>
 
213
    </td></tr>
 
214
    <tr><td>
 
215
      <blockquote>
 
216
        <ul>
 
217
                    <li><a href="#remove-cr">
 
218
  &lt;chmod&gt; or &lt;exec&gt; don't work in Ant
 
219
        1.3 on Unix
 
220
  </a></li>
 
221
                    <li><a href="#javadoc-cannot-execute">
 
222
  JavaDoc failed: java.io.IOException: javadoc: cannot execute
 
223
  </a></li>
 
224
                </ul>
 
225
      </blockquote>
 
226
    </td></tr>
 
227
  </table>
 
228
            </blockquote>
 
229
    </td></tr>
 
230
  </table>
 
231
 
 
232
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
233
    <tr><td bgcolor="#525D76">
 
234
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
235
        <strong>Answers</strong>
 
236
      </font>
 
237
    </td></tr>
 
238
    <tr><td>
 
239
      <blockquote>
 
240
                      <a name="what-is-ant">
 
241
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
242
    <tr><td bgcolor="#828DA6">
 
243
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
244
        <strong>
 
245
          What is Ant?
 
246
        </strong>
 
247
      </font>
 
248
    </td></tr>
 
249
    <tr><td>
 
250
      <blockquote>
 
251
                              <p> Ant is a Java based build tool. In theory it is kind of
 
252
        like "make" without makes wrinkles and with the full
 
253
        portability of pure Java code.</p>
 
254
                        </blockquote>
 
255
    </td></tr>
 
256
  </table>
 
257
  </a>
 
258
        <a name="ant-name">
 
259
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
260
    <tr><td bgcolor="#828DA6">
 
261
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
262
        <strong>
 
263
          Why do you call it Ant?
 
264
        </strong>
 
265
      </font>
 
266
    </td></tr>
 
267
    <tr><td>
 
268
      <blockquote>
 
269
                              <p>According to Ant's original author James Duncan
 
270
        Davidson, the name is an acronym for "Another Neat
 
271
        Tool".</p>
 
272
                                        <p>Later explanations go along the lines of "Ants are
 
273
        doing an extremely good job at building things" or
 
274
        "Ants are very small and can carry a weight a dozen times
 
275
        of their own" - describing what Ant is intended to
 
276
        be.</p>
 
277
                        </blockquote>
 
278
    </td></tr>
 
279
  </table>
 
280
  </a>
 
281
        <a name="history">
 
282
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
283
    <tr><td bgcolor="#828DA6">
 
284
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
285
        <strong>
 
286
          Tell us a little bit about Ant's history.
 
287
        </strong>
 
288
      </font>
 
289
    </td></tr>
 
290
    <tr><td>
 
291
      <blockquote>
 
292
                              <p>Initially Ant was part of the Tomcat code base when it was
 
293
        donated to the Apache Software Foundation - it has been
 
294
        created by James Duncan Davidson, who also is the original
 
295
        author of Tomcat. Ant was there to build Tomcat, nothing
 
296
        else.</p>
 
297
                                        <p>Soon thereafter several open source Java projects realized
 
298
        that Ant could solve the problems they had with makefiles.
 
299
        Starting with the projects hosted at Jakarta and the old Java
 
300
        Apache project, Ant spread like a virus and now is the build
 
301
        tool of choice for a lot of projects.</p>
 
302
                                        <p>In January 2000 Ant was moved to a separate CVS module and
 
303
        was promoted to a project of its own, independent of
 
304
        Tomcat.</p>
 
305
                                        <p>The first version of Ant that was exposed a lager audience
 
306
        was the one that shipped with Tomcat's 3.1 release on 19 April
 
307
        2000.  This version has later been referenced to as Ant
 
308
        0.3.1.</p>
 
309
                                        <p>The first official release of Ant as a stand alone product was
 
310
        Ant 1.1 released on 19 July 2000.  The complete release
 
311
        history:</p>
 
312
                                          <table>
 
313
              <tr>
 
314
                  <td bgcolor="#039acc" colspan="" rowspan="" 
 
315
      valign="top" align="left">
 
316
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
317
          Ant Version
 
318
        </font>
 
319
  </td>
 
320
                      <td bgcolor="#039acc" colspan="" rowspan="" 
 
321
      valign="top" align="left">
 
322
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
323
          Release Date
 
324
        </font>
 
325
  </td>
 
326
      </tr>
 
327
                  <tr>
 
328
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
329
      valign="top" align="left">
 
330
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
331
          1.1
 
332
        </font>
 
333
  </td>
 
334
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
335
      valign="top" align="left">
 
336
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
337
          19 July 2000
 
338
        </font>
 
339
  </td>
 
340
      </tr>
 
341
                  <tr>
 
342
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
343
      valign="top" align="left">
 
344
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
345
          1.2
 
346
        </font>
 
347
  </td>
 
348
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
349
      valign="top" align="left">
 
350
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
351
          24 October 2000
 
352
        </font>
 
353
  </td>
 
354
      </tr>
 
355
                  <tr>
 
356
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
357
      valign="top" align="left">
 
358
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
359
          1.3
 
360
        </font>
 
361
  </td>
 
362
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
363
      valign="top" align="left">
 
364
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
365
          3 March 2001
 
366
        </font>
 
367
  </td>
 
368
      </tr>
 
369
        </table>
 
370
                        </blockquote>
 
371
    </td></tr>
 
372
  </table>
 
373
  </a>
 
374
                        <a name="no-gnu-tar">
 
375
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
376
    <tr><td bgcolor="#828DA6">
 
377
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
378
        <strong>
 
379
          I get checksum errors when I try to extract the
 
380
      <code>tar.gz</code> distribution file. Why?
 
381
        </strong>
 
382
      </font>
 
383
    </td></tr>
 
384
    <tr><td>
 
385
      <blockquote>
 
386
                              <p>Ant's distribution contains file names that are longer
 
387
        than 100 characters, which is not supported by the standard
 
388
        tar file format. Several different implementations of tar use
 
389
        different and incompatible ways to work around this
 
390
        restriction.</p>
 
391
                                        <p>Ant's &lt;tar&gt; task can create tar archives that use
 
392
        the GNU tar extension, and this has been used when putting
 
393
        together the distribution. If you are using a different
 
394
        version of tar (for example, the one shipping with Solaris),
 
395
        you cannot use it to extract the archive.</p>
 
396
                                        <p>The solution is to either install GNU tar, which can be
 
397
        found <a href="http://www.gnu.org/software/tar/tar.html">here</a> 
 
398
        or use the zip archive instead (you can extract it using
 
399
        <code>jar xf</code>).</p>
 
400
                        </blockquote>
 
401
    </td></tr>
 
402
  </table>
 
403
  </a>
 
404
                        <a name="always-recompiles">
 
405
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
406
    <tr><td bgcolor="#828DA6">
 
407
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
408
        <strong>
 
409
          Why does Ant always recompile all my Java files?
 
410
        </strong>
 
411
      </font>
 
412
    </td></tr>
 
413
    <tr><td>
 
414
      <blockquote>
 
415
                              <p>In order to find out which files should be compiled, Ant
 
416
        compares the timestamps of the source files to those of the
 
417
        resulting <code>.class</code> files.  Opening all source files
 
418
        to find out which package they belong to would be very
 
419
        inefficient - instead of this, Ant expects you to place your
 
420
        source files in a directory hierarchy that mirrors your
 
421
        package hierarchy and to point Ant to the root of this
 
422
        directory tree with the <code>srcdir</code> attribute.</p>
 
423
                                        <p>Say you have <code>&lt;javac srcdir="src"
 
424
        destdir="dest" /&gt;</code>.  If Ant finds a file
 
425
        <code>src/a/b/C.java</code> it expects it to be in package
 
426
        <code>a.b</code> so that the resulting <code>.class</code>
 
427
        file is going to be <code>dest/a/b/C.class</code>.</p>
 
428
                                        <p>If your setup is different, Ant's heuristic won't work and
 
429
        it will recompile classes that are up to date.  Ant is not the
 
430
        only tool, that expects a source tree layout like this.</p>
 
431
                        </blockquote>
 
432
    </td></tr>
 
433
  </table>
 
434
  </a>
 
435
        <a name="passing-cli-args">
 
436
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
437
    <tr><td bgcolor="#828DA6">
 
438
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
439
        <strong>
 
440
          How do I pass parameters from the command line to my
 
441
        build file?
 
442
        </strong>
 
443
      </font>
 
444
    </td></tr>
 
445
    <tr><td>
 
446
      <blockquote>
 
447
                              <p>Use properties: <code>ant
 
448
        -D&lt;name&gt;=&lt;value&gt;</code> lets you define values for
 
449
        properties.  These can then be used within your build file as
 
450
        any normal property: <code>${&lt;name&gt;}</code> will put in
 
451
        <code>&lt;value&gt;</code>.</p>
 
452
                        </blockquote>
 
453
    </td></tr>
 
454
  </table>
 
455
  </a>
 
456
        <a name="jikes-switches">
 
457
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
458
    <tr><td bgcolor="#828DA6">
 
459
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
460
        <strong>
 
461
          How can I use Jikes specific command line
 
462
        switches?
 
463
        </strong>
 
464
      </font>
 
465
    </td></tr>
 
466
    <tr><td>
 
467
      <blockquote>
 
468
                              <p>A couple of switches are supported via magic
 
469
          properties:</p>
 
470
                                          <table>
 
471
              <tr>
 
472
                  <td bgcolor="#039acc" colspan="" rowspan="" 
 
473
      valign="top" align="left">
 
474
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
475
          switch
 
476
        </font>
 
477
  </td>
 
478
                      <td bgcolor="#039acc" colspan="" rowspan="" 
 
479
      valign="top" align="left">
 
480
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
481
          property
 
482
        </font>
 
483
  </td>
 
484
                      <td bgcolor="#039acc" colspan="" rowspan="" 
 
485
      valign="top" align="left">
 
486
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
487
          default
 
488
        </font>
 
489
  </td>
 
490
      </tr>
 
491
                  <tr>
 
492
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
493
      valign="top" align="left">
 
494
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
495
          +E
 
496
        </font>
 
497
  </td>
 
498
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
499
      valign="top" align="left">
 
500
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
501
          build.compiler.emacs
 
502
        </font>
 
503
  </td>
 
504
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
505
      valign="top" align="left">
 
506
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
507
          false == not set
 
508
        </font>
 
509
  </td>
 
510
      </tr>
 
511
                  <tr>
 
512
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
513
      valign="top" align="left">
 
514
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
515
          +P
 
516
        </font>
 
517
  </td>
 
518
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
519
      valign="top" align="left">
 
520
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
521
          build.compiler.pedantic
 
522
        </font>
 
523
  </td>
 
524
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
525
      valign="top" align="left">
 
526
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
527
          false == not set
 
528
        </font>
 
529
  </td>
 
530
      </tr>
 
531
                  <tr>
 
532
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
533
      valign="top" align="left">
 
534
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
535
          +F
 
536
        </font>
 
537
  </td>
 
538
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
539
      valign="top" align="left">
 
540
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
541
          build.compiler.fulldepend
 
542
        </font>
 
543
  </td>
 
544
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
545
      valign="top" align="left">
 
546
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
547
          false == not set
 
548
        </font>
 
549
  </td>
 
550
      </tr>
 
551
                  <tr>
 
552
                  <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
553
      valign="top" align="left">
 
554
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
555
          <strong>only for Ant &lt; 1.4, replaced by the nowarn
 
556
                attribute of javac after that</strong> -nowarn
 
557
        </font>
 
558
  </td>
 
559
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
560
      valign="top" align="left">
 
561
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
562
          build.compiler.warnings
 
563
        </font>
 
564
  </td>
 
565
                      <td bgcolor="#a0ddf0" colspan="" rowspan="" 
 
566
      valign="top" align="left">
 
567
    <font color="#000000" size="-1" face="arial,helvetica,sanserif">
 
568
          true == not set
 
569
        </font>
 
570
  </td>
 
571
      </tr>
 
572
        </table>
 
573
                        </blockquote>
 
574
    </td></tr>
 
575
  </table>
 
576
  </a>
 
577
        <a name="shell-redirect-1">
 
578
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
579
    <tr><td bgcolor="#828DA6">
 
580
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
581
        <strong>
 
582
          How do I include a &lt; character in my command line arguments?
 
583
        </strong>
 
584
      </font>
 
585
    </td></tr>
 
586
    <tr><td>
 
587
      <blockquote>
 
588
                              <p>The short answer is "Use <code>&amp;lt;</code>".</p>
 
589
                                        <p>The long answer is, that this probably won't do what you
 
590
        want anyway, see <a href="#shell-redirect-2">the next
 
591
        section</a>.</p>
 
592
                        </blockquote>
 
593
    </td></tr>
 
594
  </table>
 
595
  </a>
 
596
        <a name="shell-redirect-2">
 
597
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
598
    <tr><td bgcolor="#828DA6">
 
599
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
600
        <strong>
 
601
          How do I redirect standard input or standard output
 
602
        in the <code>&lt;exec&gt;</code> task?
 
603
        </strong>
 
604
      </font>
 
605
    </td></tr>
 
606
    <tr><td>
 
607
      <blockquote>
 
608
                              <p>Say you want to redirect the standard input stream of the
 
609
        <code>cat</code> command to read from a file, something
 
610
        like</p>
 
611
                                          <div align="left">
 
612
    <table cellspacing="4" cellpadding="0" border="0">
 
613
      <tr>
 
614
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
615
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
616
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
617
      </tr>
 
618
      <tr>
 
619
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
620
        <td bgcolor="#ffffff"><pre>
 
621
shell-prompt&gt; cat &lt; foo
 
622
</pre></td>
 
623
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
624
      </tr>
 
625
      <tr>
 
626
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
627
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
628
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
629
      </tr>
 
630
    </table>
 
631
  </div>
 
632
                                        <p>and try to translate it into</p>
 
633
                                          <div align="left">
 
634
    <table cellspacing="4" cellpadding="0" border="0">
 
635
      <tr>
 
636
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
637
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
638
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
639
      </tr>
 
640
      <tr>
 
641
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
642
        <td bgcolor="#ffffff"><pre>
 
643
&lt;exec executable=&quot;cat&quot;&gt;
 
644
  &lt;arg value=&quot;&amp;lt;&quot; /&gt;
 
645
  &lt;arg value=&quot;foo&quot; /&gt;
 
646
&lt;/exec&gt;
 
647
</pre></td>
 
648
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
649
      </tr>
 
650
      <tr>
 
651
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
652
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
653
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
654
      </tr>
 
655
    </table>
 
656
  </div>
 
657
                                        <p>This will not do what you expect.  The input-redirection is
 
658
        performed by your shell, not the command itself, so this
 
659
        should read:</p>
 
660
                                          <div align="left">
 
661
    <table cellspacing="4" cellpadding="0" border="0">
 
662
      <tr>
 
663
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
664
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
665
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
666
      </tr>
 
667
      <tr>
 
668
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
669
        <td bgcolor="#ffffff"><pre>
 
670
&lt;exec executable=&quot;/bin/sh&quot;&gt;
 
671
  &lt;arg value=&quot;-c&quot; /&gt;
 
672
  &lt;arg value=&quot;cat &amp;lt; foo&quot; /&gt;
 
673
&lt;/exec&gt;
 
674
</pre></td>
 
675
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
676
      </tr>
 
677
      <tr>
 
678
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
679
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
680
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
681
      </tr>
 
682
    </table>
 
683
  </div>
 
684
                                        <p>Note, that you must use the <code>value</code> attribute of
 
685
        <code>&lt;arg&gt;</code> in the last element.</p>
 
686
                        </blockquote>
 
687
    </td></tr>
 
688
  </table>
 
689
  </a>
 
690
                        <a name="integration">
 
691
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
692
    <tr><td bgcolor="#828DA6">
 
693
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
694
        <strong>
 
695
          Is Ant supported by my IDE/Editor?
 
696
        </strong>
 
697
      </font>
 
698
    </td></tr>
 
699
    <tr><td>
 
700
      <blockquote>
 
701
                              <p>See the <a href="external.html#IDE and Editor Integration">section 
 
702
        on IDE integration</a> on our external tools page.</p>
 
703
                        </blockquote>
 
704
    </td></tr>
 
705
  </table>
 
706
  </a>
 
707
        <a name="emacs-mode">
 
708
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
709
    <tr><td bgcolor="#828DA6">
 
710
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
711
        <strong>
 
712
          Why doesn't (X)Emacs/vi/MacOS X's project builder
 
713
      parse the error messages generated by Ant correctly?
 
714
        </strong>
 
715
      </font>
 
716
    </td></tr>
 
717
    <tr><td>
 
718
      <blockquote>
 
719
                              <p>Ant adds a "banner" with the name of the current
 
720
        task in front of all messages - and there are no built-in
 
721
        regular expressions in your Editor that would account for
 
722
        this.</p>
 
723
                                        <p>You can disable this banner by invoking Ant with the
 
724
        <code>-emacs</code> switch. Alternatively you can add the
 
725
        following snippet to your <code>.emacs</code> to make Emacs
 
726
        understand Ant's output.</p>
 
727
                                          <div align="left">
 
728
    <table cellspacing="4" cellpadding="0" border="0">
 
729
      <tr>
 
730
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
731
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
732
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
733
      </tr>
 
734
      <tr>
 
735
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
736
        <td bgcolor="#ffffff"><pre>
 
737
(require 'compile)
 
738
(setq compilation-error-regexp-alist
 
739
  (append (list 
 
740
     ;; works for jikes
 
741
     '(&quot;^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:&quot; 1 2 3)
 
742
     ;; works for javac 
 
743
     '(&quot;^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):&quot; 1 2))
 
744
  compilation-error-regexp-alist))
 
745
</pre></td>
 
746
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
747
      </tr>
 
748
      <tr>
 
749
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
750
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
751
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
752
      </tr>
 
753
    </table>
 
754
  </div>
 
755
                                        <p>Yet another alternative that preserves most of Ant's
 
756
        formatting is to pipe Ant's output through the following Perl
 
757
        script by Dirk-Willem van Gulik:</p>
 
758
                                          <div align="left">
 
759
    <table cellspacing="4" cellpadding="0" border="0">
 
760
      <tr>
 
761
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
762
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
763
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
764
      </tr>
 
765
      <tr>
 
766
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
767
        <td bgcolor="#ffffff"><pre>
 
768
#!/usr/bin/perl
 
769
#
 
770
# May 2001 dirkx@apache.org - remove any
 
771
# [foo] lines from the output; keeping
 
772
# spacing more or less there.
 
773
#
 
774
$|=1;
 
775
while(&lt;STDIN&gt;) {
 
776
        if (s/^(\s+)\[(\w+)\]//) {
 
777
                if ($2 ne $last) {
 
778
                        print &quot;$1\[$2\]&quot;;
 
779
                        $s = ' ' x length($2);
 
780
                } else {
 
781
                        print &quot;$1 $s &quot;;
 
782
                };
 
783
                $last = $2;
 
784
        };
 
785
        print;
 
786
};
 
787
</pre></td>
 
788
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
789
      </tr>
 
790
      <tr>
 
791
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
792
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
793
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
794
      </tr>
 
795
    </table>
 
796
  </div>
 
797
                        </blockquote>
 
798
    </td></tr>
 
799
  </table>
 
800
  </a>
 
801
                        <a name="dtd">
 
802
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
803
    <tr><td bgcolor="#828DA6">
 
804
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
805
        <strong>
 
806
          Is there a DTD that I can use to validate my build
 
807
      files?
 
808
        </strong>
 
809
      </font>
 
810
    </td></tr>
 
811
    <tr><td>
 
812
      <blockquote>
 
813
                              <p>An incomplete DTD can be created by the
 
814
          <code>&lt;antstructure&gt;</code> task - but this one
 
815
          has a few problems:</p>
 
816
                                        <ul>
 
817
            <li>It doesn't know about required attributes.  Only
 
818
            manual tweaking of this file can help here.</li>
 
819
          
 
820
            <li>It is not complete - if you add new tasks via
 
821
            <code>&lt;taskdef&gt;</code> it won't know about it.  See
 
822
            <a href="http://www.sdv.fr/pages/casa/html/ant-dtd.en.html">this
 
823
            page</a> by Michel Casabianca for a solution to this
 
824
            problem.  Note that the DTD you can download at this page
 
825
            is based on Ant 0.3.1.</li>
 
826
 
 
827
            <li>It may even be an invalid DTD.  As Ant allows tasks
 
828
            writers to define arbitrary elements, name collisions will
 
829
            happen quite frequently - if your version of Ant contains
 
830
            the optional <code>&lt;test&gt;</code> and
 
831
            <code>&lt;junit&gt;</code> tasks, there are two XML
 
832
            elements named test (the task and the nested child element
 
833
            of <code>&lt;junit&gt;</code>) with different attribute
 
834
            lists.  This problem cannot be solved, DTDs don't give a
 
835
            syntax rich enough to support this.</li>
 
836
          </ul>
 
837
                        </blockquote>
 
838
    </td></tr>
 
839
  </table>
 
840
  </a>
 
841
        <a name="xml-entity-include">
 
842
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
843
    <tr><td bgcolor="#828DA6">
 
844
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
845
        <strong>
 
846
          How do I include an XML snippet in my build file?
 
847
        </strong>
 
848
      </font>
 
849
    </td></tr>
 
850
    <tr><td>
 
851
      <blockquote>
 
852
                              <p>You can use XML's way of including external files and let
 
853
        the parser do the job for Ant:</p>
 
854
                                          <div align="left">
 
855
    <table cellspacing="4" cellpadding="0" border="0">
 
856
      <tr>
 
857
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
858
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
859
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
860
      </tr>
 
861
      <tr>
 
862
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
863
        <td bgcolor="#ffffff"><pre>
 
864
&lt;?xml version=&quot;1.0&quot;?&gt;
 
865
 
 
866
&lt;!DOCTYPE project [
 
867
    &lt;!ENTITY common SYSTEM &quot;file:./common.xml&quot;&gt;
 
868
]&gt;
 
869
 
 
870
&lt;project name=&quot;test&quot; default=&quot;test&quot; basedir=&quot;.&quot;&gt;
 
871
 
 
872
  &lt;target name=&quot;setup&quot;&gt;
 
873
    ...
 
874
  &lt;/target&gt;
 
875
 
 
876
  &amp;common;
 
877
 
 
878
  ...
 
879
 
 
880
&lt;/project&gt;
 
881
</pre></td>
 
882
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
883
      </tr>
 
884
      <tr>
 
885
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
886
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
887
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
888
      </tr>
 
889
    </table>
 
890
  </div>
 
891
                                        <p>will literally include the contents of <code>common.xml</code> where
 
892
        you've placed the <code>&amp;common;</code> entity.</p>
 
893
                                        <p>In combination with a DTD, this would look like this:</p>
 
894
                                          <div align="left">
 
895
    <table cellspacing="4" cellpadding="0" border="0">
 
896
      <tr>
 
897
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
898
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
899
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
900
      </tr>
 
901
      <tr>
 
902
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
903
        <td bgcolor="#ffffff"><pre>
 
904
&lt;!DOCTYPE project PUBLIC &quot;-//ANT//DTD project//EN&quot; &quot;file:./ant.dtd&quot; [
 
905
   &lt;!ENTITY include SYSTEM &quot;file:./header.xml&quot;&gt;
 
906
]&gt;
 
907
</pre></td>
 
908
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
909
      </tr>
 
910
      <tr>
 
911
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
912
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
913
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
914
      </tr>
 
915
    </table>
 
916
  </div>
 
917
                        </blockquote>
 
918
    </td></tr>
 
919
  </table>
 
920
  </a>
 
921
        <a name="mail-logger">
 
922
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
923
    <tr><td bgcolor="#828DA6">
 
924
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
925
        <strong>
 
926
          How do I send an email with the result of my build
 
927
        process?
 
928
        </strong>
 
929
      </font>
 
930
    </td></tr>
 
931
    <tr><td>
 
932
      <blockquote>
 
933
                              <p>You can use a custom BuildListener, that sends out an email
 
934
        in the buildFinished() method.  Will Glozer
 
935
        &lt;will.glozer@jda.com&gt; has written such a listener based
 
936
        on <a href="http://java.sun.com/products/javamail/">JavaMail</a>, 
 
937
        the source is</p>
 
938
                                          <div align="left">
 
939
    <table cellspacing="4" cellpadding="0" border="0">
 
940
      <tr>
 
941
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
942
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
943
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
944
      </tr>
 
945
      <tr>
 
946
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
947
        <td bgcolor="#ffffff"><pre>
 
948
import java.io.*;
 
949
import java.util.*;
 
950
import javax.mail.*;
 
951
import javax.mail.internet.*;
 
952
import org.apache.tools.ant.*;
 
953
 
 
954
/**
 
955
 * A simple listener that waits for a build to finish and sends an email
 
956
 * of the results.  The settings are stored in &quot;monitor.properties&quot; and
 
957
 * are fairly self explanatory.
 
958
 *
 
959
 * @author      Will Glozer
 
960
 * @version     1.05a 09/06/2000
 
961
 */
 
962
public class BuildMonitor implements BuildListener {
 
963
    protected Properties props;
 
964
 
 
965
    /**
 
966
     * Create a new BuildMonitor.
 
967
     */
 
968
    public BuildMonitor() throws Exception {
 
969
        props = new Properties();
 
970
        InputStream is = getClass().getResourceAsStream(&quot;monitor.properties&quot;);
 
971
        props.load(is);
 
972
        is.close();
 
973
    }
 
974
 
 
975
    public void buildStarted(BuildEvent e) {
 
976
    }
 
977
 
 
978
    /**
 
979
     * Determine the status of the build and the actions to follow, now that
 
980
     * the build has completed.
 
981
     *
 
982
     * @param       e       Event describing the build tatus.
 
983
     */
 
984
    public void buildFinished(BuildEvent e) {
 
985
        Throwable th = e.getException();
 
986
        String status = (th != null) ? &quot;failed&quot; : &quot;succeeded&quot;;
 
987
        
 
988
        try {
 
989
            String key = &quot;build.&quot; + status;
 
990
            if (props.getProperty(key + &quot;.notify&quot;).equalsIgnoreCase(&quot;false&quot;)) {
 
991
                    return;
 
992
            }
 
993
            
 
994
            Session session = Session.getDefaultInstance(props, null);
 
995
 
 
996
            MimeMessage message = new MimeMessage(session);
 
997
            message.addRecipients(Message.RecipientType.TO, parseAddresses(
 
998
                props.getProperty(key + &quot;.email.to&quot;)));
 
999
            message.setSubject(props.getProperty(key + &quot;.email.subject&quot;));
 
1000
 
 
1001
            BufferedReader br = new BufferedReader(new FileReader(
 
1002
                props.getProperty(&quot;build.log&quot;)));
 
1003
            StringWriter sw = new StringWriter();
 
1004
            
 
1005
            String line = br.readLine();
 
1006
            while (line != null) {
 
1007
                sw.write(line);
 
1008
                sw.write(&quot;\n&quot;);
 
1009
                line = br.readLine();
 
1010
            }
 
1011
            br.close();
 
1012
            
 
1013
            message.setText(sw.toString(), &quot;UTF-8&quot;);
 
1014
            sw.close();
 
1015
            
 
1016
            Transport transport = session.getTransport();
 
1017
            transport.connect();
 
1018
            transport.send(message);
 
1019
            transport.close();
 
1020
        } catch (Exception ex) {
 
1021
            System.out.println(&quot;BuildMonitor failed to send email!&quot;);
 
1022
            ex.printStackTrace();
 
1023
        }
 
1024
    }
 
1025
 
 
1026
    /**
 
1027
     * Parse a comma separated list of internet email addresses.
 
1028
     *
 
1029
     * @param       s       The list of addresses.
 
1030
     * @return      Array of Addresses.
 
1031
     */
 
1032
    protected Address[] parseAddresses(String s) throws Exception {
 
1033
        StringTokenizer st = new StringTokenizer(s, &quot;,&quot;);
 
1034
        Address[] addrs = new Address[st.countTokens()];
 
1035
 
 
1036
        for (int i = 0; i &lt; addrs.length; i++) {
 
1037
            addrs[i] = new InternetAddress(st.nextToken());
 
1038
        }
 
1039
        return addrs;
 
1040
    }
 
1041
 
 
1042
    public void messageLogged(BuildEvent e) {
 
1043
    }
 
1044
 
 
1045
    public void targetStarted(BuildEvent e) {
 
1046
    }
 
1047
 
 
1048
    public void targetFinished(BuildEvent e) {
 
1049
    }
 
1050
 
 
1051
    public void taskStarted(BuildEvent e) {        
 
1052
    }
 
1053
 
 
1054
    public void taskFinished(BuildEvent e) {
 
1055
    }
 
1056
}
 
1057
</pre></td>
 
1058
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1059
      </tr>
 
1060
      <tr>
 
1061
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1062
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1063
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1064
      </tr>
 
1065
    </table>
 
1066
  </div>
 
1067
                                        <p>With a <code>monitor.properties</code> like this</p>
 
1068
                                          <div align="left">
 
1069
    <table cellspacing="4" cellpadding="0" border="0">
 
1070
      <tr>
 
1071
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1072
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1073
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1074
      </tr>
 
1075
      <tr>
 
1076
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1077
        <td bgcolor="#ffffff"><pre>
 
1078
# configuration for build monitor
 
1079
 
 
1080
mail.transport.protocol=smtp
 
1081
mail.smtp.host=&lt;host&gt;
 
1082
mail.from=Will Glozer &lt;will.glozer@jda.com&gt;
 
1083
 
 
1084
build.log=build.log
 
1085
 
 
1086
build.failed.notify=true
 
1087
build.failed.email.to=will.glozer@jda.com
 
1088
build.failed.email.subject=Nightly build failed!
 
1089
 
 
1090
build.succeeded.notify=true
 
1091
build.succeeded.email.to=will.glozer@jda.com
 
1092
build.succeeded.email.subject=Nightly build succeeded!
 
1093
</pre></td>
 
1094
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1095
      </tr>
 
1096
      <tr>
 
1097
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1098
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1099
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1100
      </tr>
 
1101
    </table>
 
1102
  </div>
 
1103
                                        <p><code>monitor.properties</code> should be placed right next
 
1104
        to your compiled <code>BuildMonitor.class</code>.  To use it,
 
1105
        invoke Ant like</p>
 
1106
                                          <div align="left">
 
1107
    <table cellspacing="4" cellpadding="0" border="0">
 
1108
      <tr>
 
1109
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1110
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1111
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1112
      </tr>
 
1113
      <tr>
 
1114
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1115
        <td bgcolor="#ffffff"><pre>
 
1116
ant -listener BuildMonitor
 
1117
</pre></td>
 
1118
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1119
      </tr>
 
1120
      <tr>
 
1121
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1122
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1123
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1124
      </tr>
 
1125
    </table>
 
1126
  </div>
 
1127
                                        <p>Make sure that <code>mail.jar</code> from JavaMail and
 
1128
        <code>activation.jar</code> from the 
 
1129
        <a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">Java
 
1130
        Beans Activation Framework</a> in your <code>CLASSPATH</code>.</p>
 
1131
                        </blockquote>
 
1132
    </td></tr>
 
1133
  </table>
 
1134
  </a>
 
1135
                        <a name="remove-cr">
 
1136
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
1137
    <tr><td bgcolor="#828DA6">
 
1138
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
1139
        <strong>
 
1140
          &lt;chmod&gt; or &lt;exec&gt; don't work in Ant
 
1141
        1.3 on Unix
 
1142
        </strong>
 
1143
      </font>
 
1144
    </td></tr>
 
1145
    <tr><td>
 
1146
      <blockquote>
 
1147
                              <p>The <code>antRun</code> script in <code>ANT_HOME/bin</code>
 
1148
        has DOS instead of Unix line endings, you must remove the
 
1149
        carriage return characters from this file.  This can be done by
 
1150
        using Ant's &lt;fixcrlf&gt; task or something like:</p>
 
1151
                                          <div align="left">
 
1152
    <table cellspacing="4" cellpadding="0" border="0">
 
1153
      <tr>
 
1154
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1155
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1156
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1157
      </tr>
 
1158
      <tr>
 
1159
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1160
        <td bgcolor="#ffffff"><pre>
 
1161
tr -d '\r' &lt; $ANT_HOME/bin/antRun &gt; /tmp/foo
 
1162
mv /tmp/foo $ANT_HOME/bin/antRun
 
1163
</pre></td>
 
1164
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1165
      </tr>
 
1166
      <tr>
 
1167
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1168
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1169
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
 
1170
      </tr>
 
1171
    </table>
 
1172
  </div>
 
1173
                        </blockquote>
 
1174
    </td></tr>
 
1175
  </table>
 
1176
  </a>
 
1177
        <a name="javadoc-cannot-execute">
 
1178
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
 
1179
    <tr><td bgcolor="#828DA6">
 
1180
      <font color="#ffffff" face="arial,helvetica,sanserif">
 
1181
        <strong>
 
1182
          JavaDoc failed: java.io.IOException: javadoc: cannot execute
 
1183
        </strong>
 
1184
      </font>
 
1185
    </td></tr>
 
1186
    <tr><td>
 
1187
      <blockquote>
 
1188
                              <p>There is a bug in the Solaris reference implementation of
 
1189
        the JDK, see <a href="http://developer.java.sun.com/developer/bugParade/bugs/4230399.html">http://developer.java.sun.com/developer/bugParade/bugs/4230399.html</a>.
 
1190
        This also appears to be true under Linux, moving the JDK to
 
1191
        the front of the PATH fixes the problem.</p>
 
1192
                        </blockquote>
 
1193
    </td></tr>
 
1194
  </table>
 
1195
  </a>
 
1196
              </blockquote>
 
1197
    </td></tr>
 
1198
  </table>
 
1199
            </td>
 
1200
        </tr>
 
1201
 
 
1202
        <!-- FOOTER -->
 
1203
        <tr><td colspan="2">
 
1204
          <hr noshade="" size="1"/>
 
1205
        </td></tr>
 
1206
        <tr><td colspan="2">
 
1207
          <div align="center"><font color="#525D76" size="-1"><em>
 
1208
          Copyright &#169; 1999-2001, Apache Software Foundation
 
1209
          </em></font></div>
 
1210
        </td></tr>
 
1211
      </table>
 
1212
    </body>
 
1213
  </html>
 
1214
<!-- end the processing -->
 
1215
 
 
1216
 
 
1217
 
 
1218
 
 
1219
 
 
1220