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.

Weaving sources

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 ...

Get AspectJ in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.