如何在 Eclipse 插件中使用 AspectJ

发布于 2024-09-30 18:26:16 字数 311 浏览 0 评论 0原文

正如之前的问题中提到的,我是试图检查我的所有结果集是否都已关闭。为此,我想使用 AspcetJ,但经过 1 天的艰苦奋斗,我无法在插件上下文中使用方面。

我想要的是有一个方面项目定义几个方面来检查结果集,然后使用我的自定义插件启动新的 eclipse 调试配置,并将我的方面应用到这些插件上。

如何实现呢?

提前致谢, 马努

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

由于您在 OSGi 环境中运行,因此需要使用一种特定的加载时编织样式,即 OSGi 感知的样式。标准编译时编织或 LTW 将不起作用。这是因为 OSGi 对每个插件使用不同的类加载器,并且 Eclipse 使用的插件集在启动前是未知的。

看看 Equinox Aspects(又名春分编织):

http ://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php

本质上,您需要对方面插件的清单文件进行一些更改,添加 aop.xml 文件,并确保您的方面插件设置为 autostarted=true。

[编辑]
从 eclipse Juno 开始,步骤已更改,请参阅:http://wiki.eclipse.org/Equinox_Weaving_QuickStart

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文