tags:

views:

352

answers:

3

Let's say I have few aspects, which I have already compiled, and now I just want to compile single source file, but without recompiling the aspects, since it takes a lot of time. Is there any way to do so?

For example, I have the following:

  • Trace.aj
  • Log.aj
  • Test.java

All of them were compiled during my "build-all", and now I've changed Test.java and wants to recompile it using the (already compiled) aspects.

A: 

I'm not sure load time weaving is the right approach in this case. You typically use load time weaving when you want to modify the behaviour of classes that have already been compiled. In this case you are compiling the Test type. If the aspects are relatively stable, you can separate them into another project and build that into a jar (say trace.jar), you can then modify the AJDT configuration to add the jar to the aspect libraries (from memory, so apologies if it's not accurate, go to the project properties, select the aspectj compiler option, select the aspect libraries/path tab and add your aspect jar). Doing this means that the aspects in the jar will be applied to Test.java on each build.

Rich Seller
A: 

I used Rich's suggestion above to use the already compiled aspect to apply to Test.java during the build. We are using maven, and this link also helped: http://maven.apache.org/plugins/maven-eclipse-plugin/examples/ajdt-projects.html

jffmrk