Hi, With all the questions, are you just trying to find out what bits of AspectJ I don't know :)
> So, I am doing something wrong. How can I enable just one aspect for LTW and > keep the rest for CTW in Eclipse? What you are asking about is what we call reweaving. It is the act of weaving-something-that-is-already-woven. Now, in original AspectJ this wasn't possible - it would just fail saying you can't weave that (at loadtime) as you have already woven it (at compile time). A few years ago 'reweaving' came along which said that in order preserve semantics (because weaving effectively introduces new joinpoints due to weaving process which later aspects might hit), when you attempt the second weave we would revert to the original unwoven bytecode and apply the initial set of aspects at the same time as the new aspects. This is what you are doing right now and it is why it is telling you it wants to see those original aspects when the loadtime weaving is attempted. Then this model broke down because of other bytecode tools being involved between the two weaving stages which damaged our ability to get back to the original bytecode. This led to the creation of overweaving, discussed here: http://andrewclement.blogspot.com/2010/05/aspectj-overweaving.html Switching on overweaving specifies that you don't mind the extra joinpoints that have appeared due to the first weave because you don't think the second set of aspects will be affected, so it doesn't revert to the original code and so doesnt ask for the original aspects to be around, phew. Back to the question at hand. You can use overweaving, switch it on by adding an extra bit to your aop.xml: <weaver options="-showWeaveInfo -Xset:weaveJavaxPackages=true,overWeaving=true"/> Although I am a bit surprised you get the error you are seeing if the weaver can see both the aop-ajc.xml and your aop.xml. It is possible not a huge amount of testing was done on a compile-time-weaving followed by loadtime-weaving. Usually people will do one or the other. However, it should work and we should fix it if there are issues here. Let me know how you get on, cheers, Andy On 14 December 2011 14:35, Mark <[email protected]> wrote: > I cannot find how to instruct AspectJ to weave only one aspect during the > load-time and the rest - during the compile-time. > > After creating Load-Time Weaving AspectJ Run Configuration, the file > aop-ajc.xml has been created: > ===================================================================== > <?xml version="1.0" encoding="UTF-8"?> > <aspectj> > <aspects> > <aspect name="com.shunra.poc.security.AuthorizerAspect"/> > <aspect name="com.shunra.poc.logging.LoggerHolderAspect"/> > <aspect name="com.shunra.poc.logging.LoggerAspect"/> > <aspect > name="com.shunra.poc.handlers.ResourceHandlerLoggerAspect"/> > <aspect > name="com.shunra.poc.handlers.ConverterProviderWorkaroundAspect"/> > <aspect name="com.shunra.poc.UserRepositoryFailAspect"/> > <aspect name="com.shunra.poc.ServiceLoggerAspect"/> > <aspect name="com.shunra.poc.ResponseToStringAspect"/> > </aspects> > <weaver options="-showWeaveInfo -Xset:weaveJavaxPackages=true"/> > </aspectj> > ===================================================================== > > Now, I have added my own aop.xml: > ===================================================================== > <?xml version="1.0" encoding="UTF-8"?> > <aspectj> > <aspects> > <include within="com.shunra.poc.ResponseToStringAspect"/> > </aspects> > </aspectj> > ===================================================================== > > Running the configuration displays may red lines on the Eclipse console in > the same spirit as the following one: > [WeavingURLClassLoader] error aspect 'com.shunra.poc.ServiceLoggerAspect' > woven into 'com.shunra.poc.Program' must be defined to the weaver (placed on > the aspectpath, or defined in an aop.xml file if using LTW). > > So, I am doing something wrong. How can I enable just one aspect for LTW and > keep the rest for CTW in Eclipse? > > Thanks. > > -- > View this message in context: > http://aspectj.2085585.n4.nabble.com/Why-would-one-ever-want-to-use-Load-Time-Weaving-tp4181328p4197371.html > Sent from the AspectJ - users mailing list archive at Nabble.com. > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
