简体   繁体   English

编织Eclipse 3.7插件项目中包含的AspectJ方面

[英]Weaving AspectJ aspects included in an Eclipse 3.7 plugin project

Goal 目标

I am building an Eclipse plugin targeting the 3.7 environment and would like to include an aspect in the plugin that provides advice on code that is also in the plugin. 我正在构建一个针对3.7环境的Eclipse插件,并希望在插件中包含一个方面,该插件提供有关插件中代码的建议。

Setup 设定

I have been trying to follow along with the spirit of these guidelines as best I can considering the apparent differences between 3.4 and 3.7: http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php 我一直在努力遵循这些准则的精神,因为我可以考虑3.4和3.7之间的明显差异: http//www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start。 PHP

Here is what I have so far: 这是我到目前为止:

  1. A plugin project with the aspect and some source. 一个带有方面和一些来源的插件项目。
  2. The plugin project has been converted to an AspectJ project, which triggered Eclipse to automatically add org.aspectj.runtime (1.6.12) to the plugin's dependencies. 插件项目已转换为AspectJ项目,该项目触发Eclipse自动将org.aspectj.runtime (1.6.12)添加到插件的依赖项中。
  3. I checked "Reexport this dependency" on the org.aspectj.runtime dependency in my plugin configuration. 我在插件配置中检查了org.aspectj.runtime依赖项中的“Reexport this dependency”。
  4. I defined the aspect in an aop.xml in my META-INF directory. 我在META-INF目录中的aop.xml中定义了方面。
  5. My MANIFEST.MF has an Export-Package entry on the package that the aspect is in. 我的MANIFEST.MF在方面所在的包上有一个Export-Package条目。
  6. My run configuration includes the following plugins and start levels: 我的运行配置包括以下插件和启动级别:
    • org.eclipse.equinox.weaving.aspectj (start level of 1) org.eclipse.equinox.weaving.aspectj (起始级别为1)
    • org.eclipse.equinox.weaving.hook (start level of default which is 4) org.eclipse.equinox.weaving.hook (默认的起始级别为4)
    • org.aspectj.runtime (start level of 1) org.aspectj.runtime (开始等级1)
    • org.aspectj.weaver (start level of 1) org.aspectj.weaver (起始级别为1)

Current results 目前的结果

I see lines in the console that look like this, but it appears that this processing occurs the first time each class is classloaded. 我看到控制台中的行看起来像这样,但看起来这个处理是在每个类第一次加载类时发生的。

[com.my.traceeditor] info processing reweavable type com.my.util.ByteUtil: com\\my\\util\\ByteUtil.java

No advice is being applied. 没有任何建议被应用。 Is it possible the weaver isn't weaving early enough? 编织者是否有可能不够早编织? What to do? 该怎么办?

When you are writing an aspect that is only to be applied in the same bundle, then you don't need equinox weaving. 当您编写仅在同一束中应用的方面时,您不需要昼夜平分点编织。 That is only for cross-bundle weaving. 这仅适用于交叉束编织。 You can remove the dependency on the weaving plugins as long as you make sure that your bundle is using compile-time weaving. 只要确保捆绑包使用编译时编织,就可以删除对编织插件的依赖性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM