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.

readme-build-and-test-aspectj.html 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <html>
  2. <head>
  3. <title>Build and Test AspectJ</title>
  4. </head>
  5. <body>
  6. <h1>Build and Test AspectJ</h1>
  7. This describes how to build and test AspectJ
  8. for developers working on source code for AspectJ.
  9. It covers building with Ant or Eclipse and testing with
  10. JUnit and the harness used for compiler tests.
  11. For information on how the build works and how to
  12. debug failed builds, see
  13. <a href="readme-build-module.html">
  14. readme-build-module.html</a>.
  15. <ol>
  16. <li>Quick start</li>
  17. <li>Requirements</li>
  18. <li>Standard builds
  19. <ol>
  20. <li>Building using Ant</li>
  21. <li>Building with Eclipse</li>
  22. <li>Running the Ant build scripts from Eclipse</li>
  23. <li>Using Eclipse to compile but Ant to assemble</li>
  24. </ol>
  25. </li>
  26. <li>Running build products
  27. <ol>
  28. <li>Running the compiler, browser, or harness from the command-line</li>
  29. <li>Running the compiler, browser, or harness from Eclipse</li>
  30. <li>Running Ant-built jars from Eclipse</li>
  31. </ol>
  32. </li>
  33. <li>Testing AspectJ
  34. <ol>
  35. <li>Running JUnit tests in Eclipse</li>
  36. <li>Running JUnit tests from the command-line without Eclipse</li>
  37. <li>Running JUnit tests from Ant without Eclipse</li>
  38. <li>Using the test harness to run compiler tests</li>
  39. </ol>
  40. </li>
  41. <li>Releases
  42. <ol>
  43. <li>Release builds</li>
  44. <li>Release preconditions and testing</li>
  45. <li>Release completion</li>
  46. </ol>
  47. </li>
  48. <li>New modules, Java 5, and Ant-only build problems</li>
  49. <li>Build Problems</li>
  50. </ol>
  51. <h3>Quick start</h3>
  52. This is a minimal introduction to building and testing AspectJ.
  53. <p/>Command-line users use CVS to check out something like this:
  54. <pre>
  55. export CVS_ROOT=":pserver:anonymous@dev.eclipse.org:/home/technology"
  56. cvs co org.aspectj/modules</pre>
  57. If using Eclipse, check out the subdirectories of
  58. <code>org.aspectj/modules</code> as Eclipse projects.
  59. Skip the <code>aspectj-attic</code> module.
  60. <p/>Build an AspectJ distribution:
  61. <pre>
  62. cd org.aspectj/modules/build
  63. ../lib/ant/bin/ant</pre>
  64. Install the distribution (e.g., into build/../aspectj-install):
  65. <pre> java -jar ../aj-build/dist/aspectj-DEVELOPMENT.jar</pre>
  66. You can skip the GUI by specifying an existing, empty writable
  67. target directory using <code>-to {targDir}</code>:
  68. <pre> java -jar ../aj-build/dist/aspectj-DEVELOPMENT.jar -to .</pre>
  69. Test it by running the build script in the examples directory:
  70. <pre> cd ../aspectj-install/doc/examples
  71. ../../lib/ant/bin/ant</pre>
  72. This should build and run the spacewar example.
  73. <h3>Required sources, libraries, and tools</h3>
  74. <p>
  75. To build requires only the AspectJ project modules and Java VM's.
  76. All necessary libraries and tools are in the
  77. <a href="../lib/">lib</a> directory, including Ant.
  78. </p>
  79. <p>To get the source, check out from CVS. E.g., from the command line,
  80. </p>
  81. <pre>
  82. export CVS_ROOT=":pserver:anonymous@dev.eclipse.org:/home/technology"
  83. cvs co org.aspectj/modules
  84. </pre>
  85. <p>
  86. Eclipse users should check out each relevant subdirectory of
  87. <code>org.aspectj/modules</code> as a project
  88. (most have .project files).
  89. </p>
  90. <p>
  91. Not all modules are required.
  92. The <code>aspectj-attic</code> module only has old code.
  93. </p>
  94. <h3>Standard builds</h3>
  95. <h4>Overview</h4>
  96. The build system is designed to work standalone and support
  97. Eclipse and Ant.
  98. Each module is an Eclipse project, and all required libraries
  99. are in lib/.
  100. All build dependencies are read from Eclipse .classpath files
  101. and managed using an Ant builder task,
  102. so no Ant build scripts need to change when dependencies change.
  103. However, that means the modules (read: Eclipse projects) can only
  104. do what the builder task understands. Currently it expects
  105. release source files in <code>src</code> (or <code>java5-src</code>
  106. for Java 5 code) and test source files in
  107. <code>testsrc</code> (or <code>java5-testsrc</code>),
  108. and can handle Java and AspectJ projects.
  109. For more information on the build infrastructure and setup, see
  110. <a href="readme-build-module.html">readme-build-module.html</a>
  111. and <a href="#antInvariants">below</a>.
  112. <h4>Building using Ant</h4>
  113. <p>
  114. You should use the Ant in ../lib/ant. Currently this is a vanilla
  115. distribution of Ant 1.6.3, but that might change.
  116. </p>
  117. <p>
  118. This <a href=".">build</a> directory has a master
  119. <a href="build.xml">build.xml</a> script, and the modules have
  120. satellite <code>build.xml</code> which support building only that
  121. module.
  122. The <a href="release">release</a> directory has scripts for doing
  123. release builds (in multiple VM's, with testing). These are run by
  124. automated build and before any AspectJ distribution.
  125. Custom <code>build.xml</code> files are in
  126. The <a href="../docs/build.xml">../docs/build.xml</a>,
  127. <a href="../org.aspectj.lib/build-aspectjlib.xml">org.aspectj.lib/build-aspectjlib.xml</a>,
  128. and <a href="../eclipse.plugin/build.xml">../eclipse.plugin/build.xml</a>.
  129. These are invoked by the master
  130. <a href="build.xml">build.xml</a> as needed.
  131. Other modules have generic <code>build.xml</code>'s that just
  132. use the master build file to run targets <code>compile</code> and
  133. <code>test</code> for that module.
  134. (If you do <code>clean</code>, all binaries for all
  135. modules are cleaned.)
  136. </p>
  137. <p>
  138. The master <a href="build.xml">build.xml</a>
  139. creates an AspectJ distribution in
  140. <a href="../aj-build/dist/aspectj-DEVELOPMENT.jar">
  141. ../aj-build/dist/aspectj-DEVELOPMENT.jar
  142. </a>;
  143. You'll notice module jar results are put in
  144. <a href="../aj-build/jars">../aj-build/jars</a>,
  145. including <code>{module}.jar</code> and <code>{module}-test.jar</code>
  146. (for the release and test classes) and
  147. <code>{module}-all.jar</code>, and
  148. <code>{module}-test-all.jar</code>
  149. (including all antecedant classes and libraries).
  150. See <a href="build.xml">build.xml</a> for other targets.
  151. </p>
  152. <p>
  153. For any build, you should create your own version of
  154. <a href="local.properties">local.properties</a>, using
  155. <a href="sample.local.properties">sample.local.properties</a>
  156. as a template.
  157. When using the master <code>build.xml</code>,
  158. consider defining "build.config" to pass flags to the Ant
  159. builder. E.g., to reuse Eclipse classes and log verbosely,
  160. <p/>
  161. <pre>
  162. ant -Dbuild.config=useEclipseCompiles,verbose
  163. </pre>
  164. <p>
  165. (<code>useEclipseCompiles</code> is incompatible with release builds
  166. since it mixes testing and release classes.)
  167. <p/>
  168. <h4>Example builds</h4>
  169. <p>
  170. For example, to build everything into a release bundle,
  171. with verbose logging:
  172. </p>
  173. <pre>
  174. cd modules/build
  175. ../lib/ant/bin/ant
  176. </pre>
  177. <p>
  178. To build only the asm module (and any modules it requires) using
  179. <code>modules/build</code>:
  180. </p>
  181. <pre>
  182. cd modules/build
  183. ../lib/ant/bin/ant -f build.xml any-module -Dmodule.name=asm
  184. </pre>
  185. <p>
  186. To build and test the asm module from that module:
  187. </p>
  188. <pre>
  189. cd modules/asm
  190. ../lib/ant/bin/ant test
  191. </pre>
  192. <p>
  193. To build the test harness into
  194. <code>../aj-build/jars/testing-drivers-all.jar</code>:
  195. </p>
  196. <pre>
  197. cd modules/build
  198. ../lib/ant/bin/ant build-harness-jar
  199. </pre>
  200. <h4>Building with Eclipse</h4>
  201. <p>
  202. As mentioned above, the modules are Eclipse projects, so
  203. once checked out, they should build as-is.
  204. (You will need to be using a version of Eclipse that can
  205. handle the .project and .classpath files in the modules/projects.)
  206. That will enable you
  207. to run the compiler or test harness from within Eclipse (see below),
  208. but it will not build the AspectJ release as Ant does.
  209. If you are making changes in Eclipse, you should set your default JRE
  210. to the minimum supported by the AspectJ tools (currently JDK 1.3)
  211. to avoid using later API's.
  212. You'll need to set some variables in your Eclipse environment;
  213. currently these are:
  214. </p>
  215. <ul>
  216. <li><u>JAVA_HOME</u>: used to access <code>JAVA_HOME/lib/tools.jar</code>
  217. </li>
  218. <li><u>JRE15_LIB</u>: used to access Java 5 libraries.
  219. Some modules/projects use Java 5 API's. These have
  220. per-project compiler settings for 5.0 compliance, but cannot
  221. be built with the default pre-1.5 VM libraries.
  222. Until the minimum VM required by the tools is 1.5,
  223. we'll need to define this variable.
  224. </li>
  225. </ul>
  226. <h4>Running the Ant build scripts from Eclipse</h4>
  227. When running Ant from older versions of Eclipse,
  228. be sure to replace the Eclipse Ant
  229. libraries with ours. In the Ant configuration, remove all jars
  230. specified by Eclipse and add all the libraries in
  231. <a href="../lib/ant/lib">../lib/ant/lib</a>
  232. as well as in <a href="../lib/junit">../lib/junit</a>.
  233. (Do not add <code>../lib/build/build.jar</code>, which is
  234. added via a taskdef declaration.)
  235. <p/>
  236. If you find on rebuilding that the build products are not
  237. being regenerated, you may need to manually delete them
  238. or restart eclipse (the files are not being closed); see
  239. <a href="readme-build-module.html">readme-build-module.html</a>
  240. for more information.
  241. <h4>Using Eclipse to compile but Ant to assemble</h4>
  242. As mentioned above,
  243. assuming Eclipse is compiling the AspectJ modules successfully,
  244. you can use Ant to assemble the Eclipse-built .class files into a
  245. product by including <code>useEclipseCompiles</code> in the
  246. <code>build.config</code>. That reduces the build process
  247. to product assembly.
  248. (And of course you can run Ant from Eclipse as described above.)
  249. <h4>Running the compiler, browser, or harness from the command-line</h4>
  250. The build produces jar files in
  251. <a href="../aj-build/jars/">../aj-build/jars/</a>,
  252. some of which have manifests specifying the main class, so they
  253. can be run using <code>java -jar {file} {arguments}</code>.
  254. <p/>To run the compiler from the command-line, use the <code>ajbrowser</code> jar file:
  255. <pre>
  256. java -jar aj-build/jars/ajbrowser-all.jar {compile arguments}
  257. </pre>
  258. This will run <code>ajbrowser</code> if you provide no arguments or
  259. only (unflagged) .lst file arguments. To run the test harness,
  260. use the <code>testing-drivers</code> jar file:
  261. <pre>
  262. java -jar aj-build/jars/testing-drivers-all.jar tests/ajcTests.xml ...
  263. </pre>
  264. <h4>Running the compiler, browser, or harness from Eclipse</h4>
  265. To run things within Eclipse, create a run configuration from the
  266. defining module using the main class:
  267. <p/>
  268. <table border="1" cellpadding="1">
  269. <tr><th>Program</th><th>Module</th><th>Main</th></tr>
  270. <tr><td>AspectJ compiler</td><td>org.aspectj.ajdt.core</td><td>org.aspectj.tools.ajc.Main</td></tr>
  271. <tr><td>AspectJ browser</td><td>ajbrowser</td><td>org.aspectj.tools.ajbrowser.Main</td></tr>
  272. <tr><td>Test harness</td><td>testing-drivers</td><td>org.aspectj.testing.drivers.Harness</td></tr>
  273. </table>
  274. <h4>Running Ant-built jars from Eclipse</h4>
  275. You can run build products (built jars) from Eclipse in two ways:
  276. <ul>
  277. <li>Put them on the classpath of some run configuration</li>
  278. <li>Select the jar files and right-click to "open with default editor"
  279. (assuming your system is configured to run .jar files)</li>
  280. </ul>
  281. You might do this to run the installer or test the browser as built.
  282. However, doing so might prevent those jar files from being recreated
  283. in the next build.
  284. It appears that sometimes these jar files are not close during the
  285. Eclipse session, which means they cannot be overwritten in new builds,
  286. even those run from a different Ant process.
  287. If you find that builds are silently failing, try deleting the
  288. build products.
  289. <h3>Testing AspectJ</h3>
  290. <p>
  291. Each module has a tree of JUnit tests in the <code>testsrc</code> directory.
  292. These parallel the <code>src</code> directories and contain roll-up suites
  293. for each package
  294. (<code>{module}/testsrc/{packagePath}/{package}Tests.java</code>) and
  295. for the module as a whole
  296. (<code>{module}/testsrc/{module}ModuleTests.java</code>).
  297. </p>
  298. <p>
  299. The AspectJ project also has <i>additional</i> custom tests in the
  300. <a href="../tests">tests module</a>,
  301. mainly the compiler tests run by the harness in
  302. <a href="../tests/ajcTests.xml">ajcTests.xml</a>. <u>It is important
  303. to run these additional compiler tests (not covered by the JUnit
  304. suite) before and after any change to the compiler.</u>
  305. </p>
  306. <p>
  307. The module <a href="../run-all-junit-tests">run-all-junit-tests</a>
  308. refers to all the other modules and the compiler tests adapted through
  309. the <a href="../tests/src">../tests/src</a>. So the easiest way to
  310. run the JUnit and compiler tests is to run the top-level suite
  311. <a href="../run-all-junit-tests/testsrc/RunTheseBeforeYouCommitTests.java">
  312. RunTheseBeforeYouCommitTests</a>.
  313. </p>
  314. <h4>Running JUnit tests in Eclipse</h4>
  315. JUnit tests may be run under eclipse by selecting any JUnit source file
  316. and creating a run configuration for it, including the roll-up
  317. root test
  318. <a href="../run-all-junit-tests/testsrc/RunTheseBeforeYouCommitTests.java">
  319. RunTheseBeforeYouCommitTests</a>.
  320. <h4>Running JUnit tests in Ant from the command line</h4>
  321. To run the JUnit tests for any module, just go there and
  322. <pre>../lib/ant/bin/ant tests</pre>.
  323. <h4>Running JUnit tests from the command-line without Eclipse or Ant</h4>
  324. <p>
  325. To run JUnit directly, put JUnit and the {module}-test-all.jar file
  326. on the classpath:
  327. </p>
  328. <pre>
  329. set cp="lib/junit/junit.jar;aj-build/jars/util-test-all.jar"
  330. java -classpath "$cp" junit.textui.TestRunner UtilModuleTests
  331. </pre>
  332. <p>
  333. The assembled (<code>-all</code>) jar files include all antecedants,
  334. except for those "skipped" (like Ant and JUnit).
  335. (For more on skipped libraries, see
  336. <a href="readme-build-module.html">readme-build-module.html</a>).
  337. </p>
  338. <h4>Using the test harness to run compiler tests</h4>
  339. <p>
  340. The <a href="build.xml">build.xml</a> <code>build-harness-jar</code>
  341. target builds a single jar with
  342. the AspectJ binaries and a test harness as the main class.
  343. It reads test suite files like
  344. <a href="../tests/ajcTests.xml">../tests/ajcTests.xml</a>;
  345. use the -help flag to see available options.
  346. For more information, see
  347. <a href="../tests/readme-tests-module.html">
  348. ../tests/readme-tests-module.html</a>.
  349. </p>
  350. <hr/>
  351. <h3><a name="releases"></a>Releases</h3>
  352. <h4>Release builds</h4>
  353. Committers do official release builds to create the distribution
  354. released in binary form from the web site.
  355. Release builds differ mainly in running
  356. from a clean, up-to-date tree and with correct build version values
  357. in <a href="local.properties">local.properties</a>, which
  358. will update <code>org.aspectj.bridge.Version</code>.
  359. Do not run using the <code>build.config</code> value
  360. <code>useEclipseCompiles</code>,
  361. because this will include testing classes in the release libraries.
  362. See <a href="#version">Version synchronization</a> below
  363. for more details on how the version is updated.
  364. <h4>Release preconditions and testing</h4>
  365. <p/>
  366. Normally, we do releases only after fixing all high-priority
  367. (P1 and P2) bugs in the bug database
  368. (<a href="http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;priority=P1&amp;priority=P2">
  369. All open AspectJ bugs with P1 and P2</a>).
  370. For bug fixes, associated tests in
  371. <code>tests/ajcTestsFailing.xml</code> are fixed and moved to
  372. <code>tests/ajcTests.xml</code>.
  373. <p/>Before a release, run the release tests as described in
  374. <a href="../tests/readme-release-tests.html">
  375. ../tests/readme-release-tests.html</a>
  376. (deprecated? using:
  377. <a href="../build/release-checklist.txt">
  378. ../build/release-checklist.txt</a>).
  379. <h4>Release completion</h4>
  380. When the release build is accepted,
  381. tag the tree with the release version
  382. so others can do diffs or create patches
  383. based on the release code. E.g., from the command line:
  384. <pre>
  385. cd org.aspectj/
  386. cvs tag -R -c v1_1_0
  387. </pre>
  388. <p/>
  389. Pushing the release out to the web involves manually updating
  390. the web with the release files and documentation,
  391. verifying the downloads and pages,
  392. and sending any release notifications.
  393. Save the release installer, test results, and any notes
  394. about deferred bugs or tests in
  395. <code>org.aspectj/releases/aspectj-{version}/</code>.
  396. <p/>
  397. <hr/>
  398. <a name="antInvariants"/>
  399. <h3>New modules, Java 5, and Ant-only build problems</h3>
  400. <p>
  401. To reiterate (and as described more fully in
  402. <a href="readme-build-module.html">readme-build-module.html</a>),
  403. the build system introspects on module and the .classpath file
  404. to determine how to build. Further, it enforces stricter build
  405. invariants than the Eclipse projects do; when your code works
  406. in Eclipse but fails in the Ant, it's your responsibility to fix it
  407. by following the build invariants below.
  408. </p>
  409. <p>
  410. <p>What to do when adding a new module (i.e., eclipse project):
  411. </p>
  412. <ol>
  413. <li>Setup like the other modules, following the invariants below, esp.
  414. <ol>
  415. <li>same directory level</li>
  416. <li>same naming conventions for source folders</li>
  417. <li>same use of known classpath variables/entries</li>
  418. </ol>
  419. </li>
  420. <li>Add module to those checked for copyright/license in
  421. <a href="testsrc/org/aspectj/build/BuildModuleTests.java">
  422. testsrc/org/aspectj/build/BuildModuleTests.java
  423. </a>
  424. </li>
  425. <li>Add module to module dependency tree as usual in Eclipse project properties</li>
  426. <li>If the module is to produce a jar visible in {AspectJ}/lib,
  427. then add a zero-length file of the correct name to
  428. <a href="products/tools/dist/lib">products/tools/dist/lib</a>
  429. and an alias to that file from the module name in
  430. <a href="src/org/aspectj/internal/tools/build/Builder.properties">
  431. Builder.properties</a>
  432. </li>
  433. <li>To make the JUnit tests visible to the Ant builder, include a
  434. top-level Ant suite titled {Module}ModuleTests.java
  435. </li>
  436. <li>Test the build in Eclipse/JUnit using
  437. <a href="testsrc/org/aspectj/internal/build/BuildModuleTest.java">
  438. testsrc/org/aspectj/internal/build/BuildModuleTest.java
  439. </a>
  440. </li>
  441. </ol>
  442. <p>
  443. How the build system introspects, and the build invariants that
  444. are enforced by the Ant build:
  445. </p>
  446. <ul>
  447. <li>A given module is identified by its directory name.
  448. </li>
  449. <li>Most modules are Eclipse Java projects; some are AspectJ projects.
  450. Eclipse is not required to build.
  451. </li>
  452. <li>The file <code>{module.name}/.classpath</code> is read to determine
  453. the source directories and required projects and libraries.
  454. </li>
  455. <li>Normal Java source files are in <code>src</code> and <code>testsrc</code>
  456. directories.
  457. </li>
  458. <li>Java 5 source files are in <code>java5-src</code> and <code>java5-testsrc</code>
  459. directories.
  460. </li>
  461. <li>Neither <code>testsrc</code> directory is used in production builds.
  462. </li>
  463. <li>
  464. This only requires what's in the
  465. <a href="../lib">../lib</a> directory and the usual Java VM's.
  466. That means modules can only depend on each other and the libraries
  467. in <a href="../lib">../lib</a>.
  468. </li>
  469. <li>Modules are built into jar files. <code>{module.name}.jar</code>
  470. includes only the module classes, and <code>{module.name}-all.jar</code>
  471. includes the module classes plus any antecendant modules and any
  472. required libraries not skipped (see below).
  473. </li>
  474. <li>A file <code>{module.name}/{module.name}.mf.txt</code>, if available,
  475. will be used as the jar file manifest, after replacing certain
  476. variables in the <code>.mf.txt</code> file.
  477. </li>
  478. <li>All required libraries are included in the production jars, except
  479. for testing libraries and those "skipped" in
  480. <a href="src/org/aspectj/internal/tools/build/Builder.properties">
  481. Builder.properties</a>
  482. (Ant, JUnit, etc.).
  483. </li>
  484. <li>Test classes are excluded from the compile process for production builds.
  485. These result in the same jar files; there is no way to
  486. tell externally whether the test classes were stripped from a jar.
  487. </li>
  488. <li>ONLY resources specified as <code>resource.pattern</code> in
  489. <a href="src/org/aspectj/internal/tools/build/Builder.properties">
  490. Builder.properties</a>
  491. are included with assembled jars.
  492. </li>
  493. <li>No <code>testing-*</code> module is used in production builds,
  494. directly or indirectly.
  495. </li>
  496. <li>It is an error for any code to depend on any <code>testsrc</code> code,
  497. whether in the same or another module.
  498. </li>
  499. <li>AspectJ projects are built in Ant using
  500. <a href="../lib/aspectj">../lib/aspectj</a>.
  501. </li>
  502. <li>Java 5 code is not supported in AspectJ (yet).
  503. </li>
  504. <li>Java 5 code is built in Ant only if JAVA_HOME points to Java 5 (or later).
  505. </li>
  506. <li>No normal code can depend on any Java 5 code.
  507. The build system checks by building everything using the
  508. lowest VM supported by the tools.
  509. </li>
  510. </ul>
  511. <p>That means there are a number of legal Eclipse projects and code
  512. arrangements which are not valid AspectJ modules.
  513. When you add modules, libraries, or dependencies, you must build
  514. with Ant to verify these invariants are not broken.
  515. </p>
  516. <h3>Build problems</h3>
  517. Some build problems and fixes encountered in the past:
  518. <ul>
  519. <li>If the build works in Eclipse, but fails in Ant,
  520. do not assume the build scripts are broken.
  521. See <a href="#antInvariants">Invariants enforced only in Ant</a>.
  522. </li>
  523. <li>If your compiles fail because Ant cannot find <code>javac</code>,
  524. put the JDK bin directory on your PATH and/or define
  525. the JAVA_HOME environment variable.
  526. Ant requires the path to the <code>javac</code> executable
  527. when the <code>BuildModule</code> taskdef runs. I think it either
  528. gets it from <code>$JAVA_HOME</code> or if the <code>bin</code>
  529. directory is on the <code>PATH</code>.
  530. </li>
  531. <li>If using an IBM JDK at version 1.4 or higher within Eclipse,
  532. then the default value of JRE_LIB will point to the jar file
  533. "core.jar." Unlike the Sun JDK, IBM does not package the full
  534. runtime into a single jar ("rt.jar"), but instead has multiple
  535. jar files. Since core.jar does not contain the graphics libraries,
  536. several of the AspectJ projects will fail to build as checked out
  537. of CVS - there are missing dependencies on AWT and swing. The
  538. solution is to add graphics.jar to the project classpaths... BUT
  539. if this is added as an ordinary (external jar), then the main
  540. ant build script will pick up the contents of graphics.jar and
  541. include it in the aspectj distribution (obvious clue, the size of
  542. the built aspectjtools.jar doubles to about 10MB). Instead, from the
  543. Java Build Path properties page of the project, select "Add Library"
  544. and add the JDK library. You now have to remove the JRE_LIB entry
  545. from the project or Eclipse complains about duplicate jar files
  546. in the path.
  547. </li>
  548. <li>More generally, if you find extra classes in the assembled jars,
  549. most likely you have added unexpected libraries to the build, e.g.,
  550. when adding libraries for the IBM JRE.
  551. To skip those, add them to the "skip.libraries" list in
  552. <a href="src/org/aspectj/internal/tools/build/Builder.properties">
  553. src/org/aspectj/internal/tools/build/Builder.properties</a>.
  554. These libraries will always be skipped for any module built this way;
  555. there is no way to include a library in one module but not another.
  556. For more information on the properties file, see
  557. <a href="readme-build-module.html">readme-build-module.html</a>.
  558. </li>
  559. </ul>
  560. </body>
  561. </html>