无法在IntelliJ中为模块启用编译后编织模式 [英] Unable to enable post-compile weave mode in IntelliJ for a module

查看:61
本文介绍了无法在IntelliJ中为模块启用编译后编织模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中有一个需要后期编织的模块.

I have a module in a project that has a need for post-time weaving.

我已将编译器配置为 Ajc ,并向模块添加了 AspectJ Facet,但是无法启用编译后编织模式".复选框显示为灰色.

I have configured my compiler to be Ajc and I have added AspectJ Facet to my module, but I am unable to enable the "Post-compile weave mode" as the checkbox is greyed out.

有人知道我在那里想念什么吗?

Anyone knows what am I missing there?

推荐答案

通常,我通过设置仅在Eclipse和IntelliJ IDEA中工作的Maven项目来完成我的AspectJ工作.为了帮助您,我只是尝试在IDEA中从头开始建立一个简单的Java + AspectJ项目.这就是我所做的(我也不得不玩一些):

Normally I do my AspectJ stuff by setting up Maven projects which just work in Eclipse and IntelliJ IDEA. In order to help you I just tried setting up a simple Java + AspectJ project from scratch in IDEA. This is what I did (I also had to play around a bit):

  • 切换为项目编译器的Ajc,设置 aspectjtools 库的路径,并激活切换以委派Javac进行后期编译和非AspectJ项目
  • aspectjrt 库添加到项目中,作为JAR的路径或使用Maven坐标
  • 在所有与AspectJ相关的模块中
  • 添加 aspectjrt 库作为依赖项,并添加AspectJ facet
  • 编辑AspectJ构面,激活编译后编织
  • Switch to Ajc as project compiler, set path to aspectjtools library and activate toggle for delegating to Javac for post-compile weaving and non-AspectJ projects
  • Add aspectjrt library to project, either as a path to a JAR or using Maven coordinates
  • Add aspectjrt library as dependency in all AspectJ-related modules and add AspectJ facet
  • Edit AspectJ facet, activate post-compile weaving

如果您的方面在单独的模块中,请还确保将该模块添加为Java模块的依赖项,并将其添加到方面路径.

If you have your aspects in a separate module, please also make sure to add that module as a dependency to the Java module and also add it to the aspect path.

请注意,如果可选地希望使用Javac来编译方面模块,则所有方面都必须使用@AspectJ语法而不是本机语法,否则,您不能委派给Javac,而必须对方面模块使用Ajc也.无论哪种方式,两个模块都必须具有AspectJ构面.

Please also note that if optionally you wish to use Javac for compiling the aspect module, all aspects have to be in @AspectJ syntax, not in native syntax, otherwise you cannot delegate to Javac but have to use Ajc for the aspect module too. Either way, both modules need to have an AspectJ facet.

已接受答案后更新:

一些IntelliJ IDEA来源供参考:

Some IntelliJ IDEA sources for reference:

这篇关于无法在IntelliJ中为模块启用编译后编织模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆