IntelliJ IDEA 2016.2 Help


In this section:


AspectJ support in IntelliJ IDEA Ultimate is based on the following plugins that are bundled with the IDE:

  • Spring AOP/@AspectJ
  • AspectJ Support

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 @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 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. For general instructions, see How-to.

  1. 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.
  2. Download and install AspectJ.
  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. Once you have installed AspectJ, you can find aspectjrt.jar in <AspectJ installation directory>\lib. See Creating a Library for aspectjrt.jar.
  4. Create aspect files and develop the code. Note that code- and annotation-style aspects are supported.
  5. If necessary, refactor the aspect code.
  6. To use the AspectJ compiler, configure the compiler settings. The compiler (ajc) is in aspectjtools.jar which is located in <AspectJ installation directory>\lib.
  7. 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.

See Also


External Links:

Last modified: 5 September 2016