Appendix B. Using Ant with AspectJ
Most developers use either Ant or Maven to build their projects. This appendix shows various weaving scenarios implemented using Ant. Appendix C does the same for Maven. Note that the focus of this appendix is the use of AspectJ weaver; therefore, we use the simplest Ant structure to get things done.
You’ll use the classes from chapter 2’s listing 2.1 and 2.2 and the profiling aspect in listing 2.4 to exercise various weaving scenarios. Let’s start with the simplest scenarios of building using source code build-time weaving.
As discussed in chapter 8, in source code build-time weaving, you supply the ajc compiler with classes and aspects in source-code form. The aspects may be expressed using either traditional syntax or @AspectJ syntax. Listing B.1 shows an Ant build file that compiles classes and aspects together.