5

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

Community
  • 1
  • 1
Manuel Selva
  • 18,554
  • 22
  • 89
  • 134

1 Answers1

6

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

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148