[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] age-old incremental compile question

It sounds like load-time weaving (LTW) is what you want. You can build normally with eclipse (i.e., using javac), then use the -javaagent option (for java 5) to have the AspectJ weaver weave in your logging aspects. Even your build.xml wouldn't have to change, unless you run the application with it (e.g., your unit tests would have to use -javaagent, if you want you aspects in your unit test runs).

This page even has a "tracing" example:


One caveat: LTW will slow down your start-up times. If you start up a, you might decide against LTW. A compromise approach is binary weaving, where you add a weaving step after compiling the Java files with javac. This is also described in the "devguide".

HTH. Good luck.


Owen Corpening wrote:
buy-in for using AspectJ is incomplete at my company, it would be *nice* if I could minimally modify build.xml and the src tree in order to add logging with an aspect.
I can figure out much of how to get from here to there, its the "minimally" part that is the problem. Should I be looking at just adding this logging aspect to the runtime of the application using runtime weaving? Are there examples of this?
The incremental compilation which involves interactively pressing enter, r, or q seems unlikely to be met with acceptance. Everyone is used to just building within eclipse then running.
It seems to me like as long as the jar containing the logging aspect is in the classpath that compiling one class at a time should be acceptable, I can't see why ajc (or iajc) would have to be invoked with every .java file in the sourcepath.
How do folks normally apply a logging aspect to a new project, where the changes are not going to be checked in so effort would be minimal?

Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" <http://autos.yahoo.com/green_center/;_ylc=X3oDMTE4MGw4Z2hlBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDZ3JlZW5jZW50ZXI-> at Yahoo! Autos' Green Center.

aspectj-users mailing list

Dean Wampler, Ph.D.
dean at aspectprogramming.com
objectmentor.com <http://www.objectmentor.com>
aspectprogramming.com <http://www.aspectprogramming.com>
contract4j.org <http://www.contract4j.org>

I want my tombstone to say:
Unknown Application Error in Dean Wampler.exe.
Application Terminated.
Okay 	Cancel