Recipe 2.4. Weaving Aspects into JarsProblemYour want to weave your aspects into code that has already been compiled and collected into a .jar file. SolutionUse the -inpath command-line option when running the ajc command. DiscussionThe ajc command weaves aspects into Java byte code which can reside in .class files, within a Java .jar library file or a mixture of the two. The following instructions show you how to take the code from Recipe 2.2 and package the MyClass class in a .jar file before weaving the HelloWorld aspect into the library:
See AlsoSetting up your environment in order to compile your AspectJ projects from the command line is covered in Recipe 2.1. |