Search code examples
javaaopaspectj

Way to oblige AspectJ to throw a runtime error if it can't find/put to run the given aspect files?


I am trying to run a complex application with complex classpaths and JVM options with some load-time aspects woven in. At the moment it doesn't seem to be doing anything, but I can't know for sure if it is in some way related to a bug in my code or in the aspect not being loaded at all. Is there any special switch that will alert me if a given aspect is not being loaded (and possible, the issue at hand)?

I've looked up the aj command line script, but it doesn't look particularly useful :(


Solution

  • Update: I forgot to mention that the option you want is -showWeaveInfo rather than (or in addition to) -verbose. While the latter shows if an aspect has been registered at all, the former shows where it is woven into your classes.


    In chapter 5 of the The AspectJ Development Environment Guide you find information about

    The former writes information about processed LTW aspects on System.err, the latter dumps all classes in specified packages to a specific directory where you can then inspect them and see if they have been woven as desired.