In this section:
An AspectJ facet which you can add to your Java modules lets you fine-tune the use of the AspectJ compiler at a module level.
Overview of AspectJ support
AspectJ support in IntelliJ IDEA Ultimate includes:
Ability to create aspects in two forms: as .aj files and java files containing classes annotated with
Coding assistance (including code completion) when writing aspect code. For annotation-style aspects, the coding assistance is provided in full; for code-style aspects, the assistance is limited to inter-type declarations.
Integration with the AcpectJ compiler ajc which you can run right from the IDE. (This compiler is part of the AspectJ distribution which you can download from the AspectJ website.)
Ability to configure ajc at the project level with an option of fine-tuning its use at the level of individual modules.
Overview of using AspectJ support
The tasks that are specific to AspectJ are outlined below.
- Make sure that:
You are using the Ultimate Edition of IntelliJ IDEA. AspectJ is not supported in the Community Edition.
The Spring AOP/@AspectJ and the AspectJ Support plugins are enabled. See Enabling AspectJ Support Plugins.
Download and install AspectJ.
Create a library containing aspectjrt.jar and add this library to dependencies of the modules in which you are going to develop your aspects. Once you have installed AspectJ, you can find aspectjrt.jar in <AspectJ installation directory>\lib. See Creating a Library for aspectjrt.jar.
Create aspect files and develop the code. Note that code- and annotation-style aspects are supported.
If necessary, refactor the aspect code.
To use the AspectJ compiler, configure the compiler settings. The compiler (ajc) is in aspectjtools.jar which is located in <AspectJ installation directory>\lib.
To fine-tune the use of ajc at the level of individual modules, add AspectJ facets to corresponding modules and adjust the facet settings accordingly.