Post-compile weaving with AspectJ inside IntelliJ IDEA

Using the AspectJ plugin, IntelliJ will automatically weave the class files of compiled classes as part of the compilation process.

Requirements

The plugin assumes AspectJ 1.6 (AspectJ 1.5 before plugin version 1.10) and has been tested with IntelliJ IDEA 12. There are also older versions of the plugin tested with IntelliJ versions 9/10/11 and 4.5/6/7/8 respectively.

For now, the plugin cannot compile AspectJ syntax aspects, so the aspects need to be precompiled or annotation style.

If aspects make use of JoinPoint information, aspectjrt.jar must be on the project classpath.

In IntelliJ 12, "Use external build" must not be checked for the plugin to work.

Installation

The plugin can easily be installed, or updated, through the plugin manager inside IntelliJ.
The plugin can also be downloaded from the menu above.

Usage

After installing, just activate the plugin for your project on the Build menu. Annotation style aspects compiled within the project will be found automatically on the next compile. If you are using AspectJ syntax (.aj) aspects or pre-compiled aspects (i.e. aspects in JAR files), you must search for them in the project settings.

Using the project settings, you can also enable or disable individual aspects.

Revision history

  • 3.0.0 - Support for IntelliJ 12. Thanks to João Marcus Christ for contributing necessary changes!
  • 2.08/2.09 - Indicating incompatibility with IntelliJ 12 in plugin meta data.
  • 2.07 - Fix problems with OpenJDK and Groovy.
  • 2.06 / 1.26 - AspectJ 1.6.10 bundled.
  • 2.05 - Changing internal naming since JetBrains "stole" the current one.
  • 2.04 - Use JDK 1.5 to fix OS X compatibility.
  • 2.03 / 1.25 - Ignore abstract aspects.
  • 2.02 / 1.24 - Fixing problems with source line references.
  • 2.01 - Support for IntelliJ 9 final.
  • 2.00 - Support for IntelliJ 9 beta. Thanks to Mario Ivankovits! Note that this version is not compatible with previous versions of IntelliJ.
  • 1.23 - Adding hidden setting noInline. Setting last compatible build.
  • 1.22 - Bundling AspectJ 1.6.5. Fixing problems with package-info.java. Thanks to Mario Ivankovits!
  • 1.21 - Avoid some problems with searching for aspects inside aspectjlib.jar. Avoid problems with disabled aspects.
  • 1.20 - Add support for IntelliJ IDEA 8.
  • 1.13 - Avoid possibility of NullPointerException introduced in 1.12.
  • 1.12 - Fix problems with @DeclareParents. Bundle AspectJ 1.6.1.
  • 1.11 - Silently ignore invalid class files when scanning for aspects.
  • 1.10 - AspectJ 1.6.0 bundled.
  • 1.07 - Bugfix: IntelliJ would hang at project load if weaving was active but no aspects listed.
  • 1.06 - AspectJ 1.5.4 bundled.
  • 1.05 - Fixing unclosed file stream.
  • 1.04 - Fixing problems with aspect inheritance/classpath issues.
  • 1.03 - Updating to AspectJ 1.5.3. Fixing a few bugs, for example regarding annotations in join point patterns.
  • 1.02 - Fixing bug related to Windows pathnames with spaces.
  • 1.01 - Internal improvement to prevent potential bug.
  • 1.00 - Fixing bugs with regards to aspects in JAR files. Several minor improvements.
  • 0.20 - Radically improved performance by storing aspects in project files. Individual aspects may be enabled/disabled in project settings
  • 0.11 - Improved message handling.
  • 0.10 - First public version.

Feedback

If you find any problems or feature requests, please contact me.

mattias.jiderhamn@expertsystems.se
Please feel free to download the source code from the menu above.