You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <meta http-equiv="Content-Language" content="en-us">
  6. <title>AjcTask Ant Support for AspectJ 1.1</title>
  7. </head>
  8. <body>
  9. <h2>
  10. <a NAME="ajc"></a>AjcTask Ant Support for AspectJ 1.1</h2>
  11. <h3>
  12. Description</h3>
  13. This task uses the AspectJ<small><sup>tm</sup></small> 1.1 compiler
  14. <code>ajc</code>.
  15. The AspectJ compiler can be used like
  16. <a href="http://jakarta.apache.org/ant/manual/CoreTasks/javac.html">Javac</a>
  17. to compile Java sources, but it can also compile AspectJ sources or
  18. weave binary aspects with Java bytecode. It can run in normal "batch" mode
  19. or in an "incremental" mode, where it only recompiles files it has to revisit.
  20. For more information on <tt>ajc</tt>, see the links from
  21. the <a href="index.html">AspectJ docs home</a>. The main things to remember:
  22. <ul>
  23. <li>In incremental mode, sources may only be specified using source root directories.
  24. </li>
  25. <li>A .class file may only be woven once. That means
  26. binaries in injars or aspectjpath must have been compiled with jikes or javac
  27. or, if using ajc, with noweave.
  28. </li>
  29. </ul>
  30. This task is named <tt>iajc</tt> now to avoid conflict with the
  31. 1.0 task <tt>ajc</tt>, but the name may change to <tt>ajc</tt> in
  32. the future.
  33. <p>
  34. See <a href="#compilerMessages">below</a> for
  35. an introduction to handling compiler messages programmatically.
  36. <p>
  37. <h3>
  38. Parameters</h3>
  39. <p>
  40. <table BORDER CELLSPACING=0 CELLPADDING=2 >
  41. <tr>
  42. <td VALIGN=TOP><b>Attribute</b></td>
  43. <td VALIGN=TOP><b>Description</b></td>
  44. <td ALIGN=CENTER VALIGN=TOP><b>Required</b></td>
  45. </tr>
  46. <tr>
  47. <th colspan="3">Specifying source and destination files</th>
  48. </tr>
  49. <td VALIGN=TOP>sourceRoots</td>
  50. <td VALIGN=TOP>Base directory of the source files.
  51. All source files (.java and .aj) in the base directories are compiled.
  52. May also be specified as a <a href="nestedElements">nested element</a>.
  53. </td>
  54. <td rowspan="2" ALIGN=CENTER VALIGN=TOP>Yes, in incremental mode.</td>
  55. </tr>
  56. <td VALIGN=TOP>sourceRootsList</td>
  57. <td VALIGN=TOP>Comma-delimited list of base directories source root
  58. directories.
  59. May also be specified as a <a href="nestedElements">nested element</a>.
  60. </td>
  61. </tr>
  62. <tr>
  63. <td VALIGN=TOP>outjar</td>
  64. <td VALIGN=TOP>Path to an output jar to generate with all output classes.</td>
  65. <td ALIGN=CENTER VALIGN=TOP>No</td>
  66. </tr>
  67. <tr>
  68. <td VALIGN=TOP>destdir</td>
  69. <td VALIGN=TOP>Specify where to place the generated class files.</td>
  70. <td ALIGN=CENTER VALIGN=TOP>No</td>
  71. </tr>
  72. <tr>
  73. <td VALIGN=TOP>classpath</td>
  74. <td VALIGN=TOP>The classpath required by the source files to compile.
  75. May also be specified as a <a href="nestedElements">nested element</a>.
  76. </td>
  77. <td ALIGN=CENTER VALIGN=TOP>No</td>
  78. </tr>
  79. <tr>
  80. <td VALIGN=TOP>srcdir</td>
  81. <td VALIGN=TOP>The nested source base directory to compile,
  82. specified as a <a href="nestedElements">nested element</a>.
  83. </td>
  84. <td ALIGN=CENTER VALIGN=TOP>No</td>
  85. </tr>
  86. <tr>
  87. <td VALIGN=TOP>aspectpath</td>
  88. <td VALIGN=TOP>The aspectpath to use -- like classpath, only for
  89. read-only, binary aspect libraries (only accepts jar/zip files, no directories).
  90. May also be specified as a <a href="nestedElements">nested element</a>.
  91. </td>
  92. <td ALIGN=CENTER VALIGN=TOP>No</td>
  93. </tr>
  94. <tr>
  95. <td VALIGN=TOP>bootclasspath</td>
  96. <td VALIGN=TOP>Location of bootstrap class files.</td>
  97. <td ALIGN=CENTER VALIGN=TOP>No</td>
  98. </tr>
  99. <tr>
  100. <td VALIGN=TOP>classpathref</td>
  101. <td VALIGN=TOP>The classpath to use, given as a<a href="http://jakarta.apache.org/ant/manual/using.html#references">
  102. reference</a> to a PATH defined elsewhere.</td>
  103. <td ALIGN=CENTER VALIGN=TOP>No</td>
  104. </tr>
  105. <tr>
  106. <td VALIGN=TOP>bootclasspathref</td>
  107. <td VALIGN=TOP>Location of bootstrap class files, given as a <a href="http://jakarta.apache.org/ant/manual/using.html#references">reference</a>
  108. to a PATH defined elsewhere.</td>
  109. <td ALIGN=CENTER VALIGN=TOP>No</td>
  110. </tr>
  111. <tr>
  112. <th colspan="3">Specifying compiler behavior</th>
  113. </tr>
  114. <tr>
  115. <td VALIGN=TOP>noweave</td>
  116. <td VALIGN=TOP>If true, produce binaries for the -injars option (only) --
  117. defaults to <tt>false</tt>.</td>
  118. <td ALIGN=CENTER VALIGN=TOP>No</td>
  119. </tr>
  120. <tr>
  121. <td VALIGN=TOP>incremental</td>
  122. <td VALIGN=TOP>Build once, then recompile on demand only required files;
  123. defaults to <tt>false</tt>.
  124. By default, files are recompiled based on input passed to stdin
  125. (see tagfile)</td>
  126. <td ALIGN=CENTER VALIGN=TOP>No</td>
  127. </tr>
  128. <tr>
  129. <td VALIGN=TOP>tagfile</td>
  130. <td VALIGN=TOP>File that controls when incremental builds are done
  131. and when the task completes.</td>
  132. <td ALIGN=CENTER VALIGN=TOP>No</td>
  133. </tr>
  134. <tr>
  135. <td VALIGN=TOP>X</td>
  136. <td VALIGN=TOP>Set experimental option(s), using comma-separated list
  137. of accepted options (unlisted here -- for XLint, use
  138. the xlint entries). Options should not contain the leading X.</td> <!-- XXX list -->
  139. <td ALIGN=CENTER VALIGN=TOP>No</td>
  140. </tr>
  141. <tr>
  142. <th colspan="3">Specifying compiler side-effects and messages</th>
  143. </tr>
  144. <tr>
  145. <td VALIGN=TOP>emacssym</td>
  146. <td VALIGN=TOP>Whether to emit <tt>.ajesym</tt> symbol files for Emacs support;
  147. defaults to <tt>false</tt>.</td>
  148. <td ALIGN=CENTER VALIGN=TOP>No</td>
  149. </tr>
  150. <tr>
  151. <td VALIGN=TOP>verbose</td>
  152. <td VALIGN=TOP>Whether to emit compiler status messages during the compile;
  153. defaults to <tt>false</tt>.</td>
  154. <td ALIGN=CENTER VALIGN=TOP>No</td>
  155. </tr>
  156. <tr>
  157. <td VALIGN=TOP>version</td>
  158. <td VALIGN=TOP>If true, do not compile - just print AspectJ version;
  159. defaults to <tt>false</tt>.</td>
  160. <td ALIGN=CENTER VALIGN=TOP>No</td>
  161. </tr>
  162. <tr>
  163. <td VALIGN=TOP>help</td>
  164. <td VALIGN=TOP>If true, just print help for the command-line compiler;
  165. defaults to <tt>false</tt>.</td>
  166. <td ALIGN=CENTER VALIGN=TOP>No</td>
  167. </tr>
  168. <tr>
  169. <td VALIGN=TOP>Xlintwarnings</td>
  170. <td VALIGN=TOP>Same as <tt>xlint:warning</tt> -
  171. if enabled, set default level of all language usage messages to warning;
  172. defaults to <tt>false</tt>.</td>
  173. <td ALIGN=CENTER VALIGN=TOP>No</td>
  174. </tr>
  175. <tr>
  176. <td VALIGN=TOP>Xlint</td>
  177. <td VALIGN=TOP>Specify default level of all language usage messages
  178. to one of (error, warning, ignore).
  179. <td ALIGN=CENTER VALIGN=TOP>No</td>
  180. </tr>
  181. <tr>
  182. <td VALIGN=TOP>Xlintfile</td>
  183. <td VALIGN=TOP>Specify property file containing name:level
  184. associations setting level for language messages emitted
  185. during compilation. Any levels set override the default
  186. associations in
  187. <code>org/aspectj/weaver/XLintDefault.properties</code>.
  188. </td>
  189. <td ALIGN=CENTER VALIGN=TOP>No</td>
  190. </tr>
  191. <tr>
  192. <td VALIGN=TOP>failonerror</td>
  193. <td VALIGN=TOP>Whether the build continues notwithstanding compile errors;
  194. defaults to <tt>true</tt>.&nbsp;</td>
  195. <td ALIGN=CENTER VALIGN=TOP>No</td>
  196. </tr>
  197. <tr>
  198. <td VALIGN=TOP>messageholderclass</td>
  199. <td VALIGN=TOP>Specify a class to use as the message holder for the compile
  200. process. The entry must be a fully-qualified name of a class resolveable
  201. from the task classpath complying with the <tt>org.aspectj.bridge.IMessageHolder</tt>
  202. interface and having a public no-argument constructor.</td>
  203. <td ALIGN=CENTER VALIGN=TOP>No</td>
  204. </tr>
  205. <tr>
  206. <th colspan="3">Eclipse compiler options</th>
  207. </tr>
  208. <tr>
  209. <td VALIGN=TOP>nowarn</td>
  210. <td VALIGN=TOP>Same as <tt>warn:none</tt>;
  211. defaults to <tt>false</tt>.&nbsp;</td>
  212. <td ALIGN=CENTER VALIGN=TOP>No</td>
  213. </tr>
  214. <tr>
  215. <td VALIGN=TOP>deprecation</td>
  216. <td VALIGN=TOP>Same as <tt>warn:deprecation</tt>;
  217. defaults to <tt>false</tt>.&nbsp;</td>
  218. <td ALIGN=CENTER VALIGN=TOP>No</td>
  219. </tr>
  220. <tr>
  221. <td VALIGN=TOP>warn</td>
  222. <td VALIGN=TOP>One or more comma-separated warning specifications:
  223. <tt>constructorName</tt>,
  224. <tt>packageDefaultMethod</tt>,
  225. <tt>deprecation</tt>,
  226. <tt>maskedCatchBlocks</tt>,
  227. <tt>unusedLocals</tt>,
  228. <tt>unusedArguments</tt>,
  229. <tt>unusedImports</tt>,
  230. <tt>syntheticAccess</tt>, or
  231. <tt>assertIdentifier</tt>.</td>
  232. <td ALIGN=CENTER VALIGN=TOP>No</td>
  233. </tr>
  234. <tr>
  235. <td VALIGN=TOP>debug</td>
  236. <td VALIGN=TOP>Same as <tt>debug:lines,vars,source</tt></td>
  237. <td ALIGN=CENTER VALIGN=TOP>No</td>
  238. </tr>
  239. <tr>
  240. <td VALIGN=TOP>debuglevel</td>
  241. <td VALIGN=TOP>One or more comma-separated debug specifications:
  242. <tt>lines</tt>,
  243. <tt>vars</tt>, or
  244. <tt>source</tt>.
  245. </td>
  246. <td ALIGN=CENTER VALIGN=TOP>No</td>
  247. </tr>
  248. <tr>
  249. <td VALIGN=TOP>PreserveAllLocals</td>
  250. <td VALIGN=TOP>Code gen preserves all local variables (for debug purposes);
  251. defaults to <tt>false</tt>.&nbsp;</td>
  252. <td ALIGN=CENTER VALIGN=TOP>No</td>
  253. </tr>
  254. <tr>
  255. <td VALIGN=TOP>noimporterror</td>
  256. <td VALIGN=TOP>No errors for unresolved imports;
  257. defaults to <tt>false</tt>.&nbsp;</td>
  258. <td ALIGN=CENTER VALIGN=TOP>No</td>
  259. </tr>
  260. <tr>
  261. <td VALIGN=TOP>referenceinfo</td>
  262. <td VALIGN=TOP>Compute reference info;
  263. defaults to <tt>false</tt>.&nbsp;</td>
  264. <td ALIGN=CENTER VALIGN=TOP>No</td>
  265. </tr>
  266. <tr>
  267. <td VALIGN=TOP>log</td>
  268. <td VALIGN=TOP>File to log compiler messages to.</td>
  269. <td ALIGN=CENTER VALIGN=TOP>No</td>
  270. </tr>
  271. <tr>
  272. <td VALIGN=TOP>encoding</td>
  273. <td VALIGN=TOP>Default source encoding format</td>
  274. <td ALIGN=CENTER VALIGN=TOP>No</td>
  275. </tr>
  276. <tr>
  277. <td VALIGN=TOP>proceedonerror</td>
  278. <td VALIGN=TOP>Keep compiling when error, dumping class files with problem methods;
  279. defaults to <tt>false</tt>.&nbsp;</td>
  280. <td ALIGN=CENTER VALIGN=TOP>No</td>
  281. </tr>
  282. <tr>
  283. <td VALIGN=TOP>progress</td>
  284. <td VALIGN=TOP>Show progress (requires log);
  285. defaults to <tt>false</tt>.&nbsp;</td>
  286. <td ALIGN=CENTER VALIGN=TOP>No</td>
  287. </tr>
  288. <tr>
  289. <td VALIGN=TOP>time</td>
  290. <td VALIGN=TOP>Display speed information;
  291. defaults to <tt>false</tt>.&nbsp;</td>
  292. <td ALIGN=CENTER VALIGN=TOP>No</td>
  293. </tr>
  294. <!--
  295. <tr>
  296. <td VALIGN=TOP>noexit</td>
  297. <td VALIGN=TOP>Disable System.exit; defaults to <tt>true</tt>.
  298. (<em>If false, this kills the Ant process</em>;
  299. to halt compile gracefully, use <tt>failonerror</tt>);
  300. &nbsp;</td>
  301. <td ALIGN=CENTER VALIGN=TOP>No</td>
  302. </tr>
  303. -->
  304. <tr>
  305. <td VALIGN=TOP>target</td>
  306. <td VALIGN=TOP>Specify target class file format (must be "1.1" or "1.2");
  307. defaults to 1.1 class file.&nbsp;</td>
  308. <td ALIGN=CENTER VALIGN=TOP>No</td>
  309. </tr>
  310. <tr>
  311. <td VALIGN=TOP>compliance</td>
  312. <td VALIGN=TOP>Set "1.3" or "1.4" source compliance level
  313. (e.g., no import from default package in 1.4);
  314. defaults to 1.3 compliance level.&nbsp;</td>
  315. <td ALIGN=CENTER VALIGN=TOP>No</td>
  316. </tr>
  317. <tr>
  318. <td VALIGN=TOP>source</td>
  319. <td VALIGN=TOP>Source assertion mode ("1.3" or "1.4");
  320. default depends on compliance mode.&nbsp;</td>
  321. <td ALIGN=CENTER VALIGN=TOP>No</td>
  322. </tr>
  323. </table>
  324. <a name="nestedElements"></a>
  325. <h3>Nested Elements</h3>
  326. This taskdef should support nested elements as the old one did;
  327. see <a href="taskdef-ajc10.html#nestedElements">taskdef-ajc10.html#nestedElements</a>.
  328. <a name="compilerMessages"></>
  329. <h3>Programmatically handling compiler messages</h3>
  330. Users may specify a message holder which is passed all
  331. messages generated by the compiler synchronously. This overrides all of the normal
  332. message printing, but does not prevent the task from failing if failonerror is true
  333. and errors or exceptions were encountered.
  334. Handling messages programmatically could be useful
  335. when using the compiler to inspect code.
  336. If aspects consist of declare [error|warning], then
  337. the compiler can act to detect invariants in the code being processed.
  338. For code to compare expected and actual messages, see the AspectJ
  339. testing module (which is not included in the binary distribution).
  340. <hr>
  341. <center>
  342. </center>
  343. </body>
  344. </html>