Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Post-compile time weaving: howto

Hi Valerian!

I guess we met earlier there (same topic):
http://stackoverflow.com/questions/12104735/aspectj-controlling-calls-in-other-jars

As I said, I would also have expected "JAR with AJ" export to include
necessary dependencies, this looks like a bug. So it is good to bring it
to the developers' attention. Maybe you should file a ticket in Bugzilla
(http://www.eclipse.org/ajdt/bugs.php). But I also gave you a
workaround (quoting myself):

>> Try "Runnable JAR file" with sub-option "Package required libraries
>> into generated JAR". It will contain the necessary libraries. As a
>> little trick you might need to create a dummy main method for one
>> aspect and create a Java run configuration for it which you need to
>> select during export so as to get to the next page of the export
>> assistant.

Just to make sure that there is nothing else wrong in your classes and
aspects: Does it work using this trick? Because basically what you want
to do is possible.

And just to double-check: You want to weave the application with
'execution' pointcuts, right? Not the plugins with 'call' pointcuts.
(That would also be possible, but somewhat more tricky and probably not
necessary for you.)
--
Alexander Kriegisch


Valerian Galeru, 04.09.2012 14:35:
> I have a Web application with a Plugin System, which actually runs in a
> Tomcat. I want to control/change the behaviour of the Web Application. I
> thought, having the JAR's of the Web Application, it would be no problem
> to use the Post-compile weaving of the AspectJ.
> 
> I tried to weave some classes in a JAR this way (in Eclipse):
> 
>   * In the AspectJ Project I added the jar file to the INPATH, where the
>     classes to be woven are.
>   * Exported the Project as "Jar with AspectJ support"
>   * Deployed the jar file exported at the step 2: No result.
> 
> Questions:
> 
>  1. In the exported aspect-jar, there are only the .class files of the
>     AspectJ project, no .class files for the INPATH-Jar. Should there be
>     other classes, from the imported INPATH-jar?
>  2. In the exported aspect-jar there is no jar with the aspectj-runtime
>     (aspectj-rt.jar). Should it be there, or how to configure the
>     virtual machine to have it?
>  3. Is post-compile weaving the way to do it, or whould I use the
>     Load-time weaving?


Back to the top