As mentioned in a previous question I am trying to check that all my ResultSet are closed. For that I want to use AspcetJ but after 1 day of hard fight I am not able to use aspects in a plugin context.
What I want is to have an aspect project defining several aspects to check resultset and then launch a new eclipse debug configuration with my custom plugins and have my aspects applied on these plugins.
How achieve that ?
Thanks in advance, Manu
Install it as you would any other Eclipse plugin, e.g. via Help -> Install New Software (in Eclipse 3.7. 1). Once installed, you can create AspectJ projects using the New -> Project menu. Now you will have an AspectJ project that you can write aspects ( .
An aspect is AspectJ's unit of modularity and has much in common with a class in the Java language. Select File > New > Other > AspectJ > Aspect or use the New Type drop-down on the toolbar to open the New Aspect wizard, which is fairly similar to the New Class wizard with just a few different options, as shown below.
Maven AspectJ Plug-inIt offers the ability to weave aspects on the classes generated and dependency libraries. This also includes the ability to add dependencies on libraries with aspects. For more information on the functionality provided by this plugin, please see the Goals document.
The AspectJ Development Tools (AJDT) project provides Eclipse platform based tool support for AOSD with AspectJ. Our goal is to deliver a user experience that is consistent with the Java Development Tools (JDT) when working with AspectJ projects and resources.
Since you are running in an OSGi environment, you need to use a specific style of load-time weaving, one that is OSGi aware. Standard compile-time weaving or LTW will not work. This is because OSGi uses a different classloader for each plugin and the set of plugins used by Eclipse is not known before startup.
Have a look at Equinox Aspects (aka equinox weaving):
http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php
Essentially, you need to make some changes to your aspect plugin's manifest file, add an aop.xml file, and ensure that your aspect plugin is set to autostarted=true.
[edit] As of eclipse Juno the steps are changed see : http://wiki.eclipse.org/Equinox_Weaving_QuickStart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With