IntelliJ IDEA 13.1.0 Web Help

Some features described here are available in Ultimate edition only.

IntelliJ IDEA's support for AspectJ is based on the following plugins that are bundled with the IDE:

  • Spring-AOP and @AspectJ Support.
  • AspectJ Support.

A dedicated AspectJ facet which you can add to your Java modules lets you specify the module-specific aspectpath thus overriding the AspectJ compiler settings defined at the project level.

On this page:

In this section:

Overview of AspectJ support

AspectJ support in IntelliJ IDEA includes:

  • Ability to create aspects in two forms: as .aj files and .java files containing classes annotated with @Aspect.
  • 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.
  • Ability to perform basic aspect refactorings such as Rename and Move, and also the Push ITDs In refactoring for inter-type declarations.
  • Integration with the AcpectJ compiler ajc which you can run from within the IDE. (This compiler is part of AspectJ Development Kit (AJDK) which you can download from the AspectJ website.)
  • Ability to flexibly configure ajc at the project level with an option of redefining the main settings (aspectpath) at the module level.
Overview of using AspectJ support

Outlined below are the tasks that are specific to AspectJ. For general instructions, see IntelliJ IDEA Usage Guidelines.

  1. Make sure that the Spring-AOP and @AspectJ Support and the AspectJ Support plugins are enabled (see Enabling AspectJ Support Plugins).
  2. Download and install the AspectJ Development Kit (AJDK).
  3. Create a library containing aspectjrt.jar and add this library to dependencies of the modules in which you are going to develop your aspects. After the installation of AJDK, aspectjrt.jar can be found in <AJDK installation directory>\lib. See Creating a Library for aspectjrt.jar.
  4. Create the aspect files and develop the code. Note that code- and annotation-style aspects are supported.
  5. If necessary, refactor the aspect code.
  6. If you are going to use the AspectJ compiler, configure the compiler settings. The compiler (ajc) is in aspectjtools.jar which is located in <AJDK installation directory>\lib.
  7. If you are going to use module-specific aspectpath, add AspectJ facets to the corresponding modules and adjust the facet settings accordingly.

See Also

Concepts:

External Links:

Web Resources: