AJDT: AspectJ Development Tools

Frequently Asked Questions

  1. Overview
    1. What is AJDT?
    2. Who develops AJDT?
    3. How does AJDT relate to the AspectJ project?
  2. Community
    1. Is there an AJDT mailing list?
    2. Are there any newsgroups for AJDT users?
    3. What do I do if I think I've found a bug in AJDT?
    4. How can I request a new feature in AJDT?
  3. Using AJDT
    1. What version of AJDT do I need?
    2. Why aren't AspectJ keywords highlighted in the editor?
    3. How can I debug AspectJ programs in Eclipse?
    4. Why don't breakpoints in around advice work?
    5. How does the Visualiser work?
    6. Why do I sometimes see errors in the editor but not in the problems view?
    7. What problems are there for types in .aj files?
    8. What happens if I write my aspects in .java files?
    9. How do I use Ant to build my AspectJ projects in AJDT?
    10. Can I upgrade my AspectJ version?
  4. Extending
    1. How can I build tools which extend AJDT?
  5. Contributing
    1. How can I contribute to the AJDT project?
    2. Where will I find the source for AJDT?
    3. How do I setup an AJDT development environment in Eclipse?
    4. How can I package my sample code for contribution to the examples plug-in?
  6. Plans
    1. Where do I find out about future releases of AJDT?
    2. What new AJDT features are being worked on at the moment?

Overview

  1. What is AJDT?

    The AspectJ Development Tools project (AJDT) is a set of plug-ins for Eclipse that provide support for aspect-oriented software development using AspectJ within the Eclipse IDE.

  2. Who develops AJDT?

    AJDT is an open-source project hosted on eclipse.org, current contributors are listed on the website. Anyone can get involved, see How can I contribute to the AJDT project?

  3. How does AJDT relate to the AspectJ project?

    AJDT provides Eclipse IDE integration for AspectJ, and includes the AJDE (AspectJ Development Environment) libraries from the AspectJ project as part of its packaging. Development of the AspectJ compiler and AJDE takes place under the AspectJ project.

Community

  1. Is there an AJDT mailing list?

    AJDT has a developers mailing list, ajdt-dev@dev.eclipse.org, with archives and subscription information available online. Questions regarding the use of AspectJ the language are best directed to the AspectJ users mailing list.

  2. Are there any newsgroups for AJDT users?

    AJDT is supported through the eclipse.technology.ajdt newsgroup. A web interface is also available.

  3. What do I do if I think I've found a bug in AJDT?

    First check the bug database to see if you've hit a known problem. If it appears to be a genuinely new bug, please submit a bug report on AJDT using bugzilla following the bug reporting guidelines.

    Extra useful information to include in an AJDT bug report:

    • Information from the AJDT Event Trace view. This view displays a lot of diagnositc information about the execution of the plug-in, for example, it will show you the exact classpaths being used for compilation, the time spent in the compiler. To open the AJDT Event Trace go to Window > Show view > Other... > AspectJ > AJDT Event Trace.

  4. How can I request a new feature in AJDT?

    Informal requests can be posted to the newsgroup or mailing list. Formal requests can be made by raising an AJDT enhancement request on Bugzilla.

Using AJDT

  1. What version of AJDT do I need?

  2. Why aren't AspectJ keywords highlighted in the editor?

    The most common cause of this problem is having AspectJ constructs in Java files (files with the .java extension) and using the JDT's Java Editor. Aspects and AspectJ constructs should be contained in .aj files which are opened with the AspectJ Editor, an extension to the Java Editor.

  3. How can I debug AspectJ programs in Eclipse?

    AspectJ programs can be run in the debugger in the same way as Java programs. The tools enable the user to step into, through and out of advice. The AspectJ development tools also provide the facility to set breakpoints in aspects.

  4. Why don't breakpoints in around advice work?

    Around advice is inlined by the weaver by default, which means that breakpoints set in the declaring aspect are not detected. To disable inlining select Window > Preferences > AspectJ > Compiler. Select the Advanced tab, then check No inline and click OK to apply.

  5. How does the Visualiser work?

    The Visualiser is an extensible Eclipse plug-in that can be used to visualize anything that lends itself to a 'bars and stripes' style representation. In AJDT the Visualiser is used to show how aspects affect a project. See the Visualiser web page for more information.

  6. Why do I sometimes see errors in the editor but not in the problems view?

    By default the AspectJ editor is used for files with the .aj extension and the Java editor for files with the .java extension. Some experienced AspectJ users may wish to use AspectJ function in .java files such as referring to ITD methods or fields, using inner aspects, implementing interfaces defined in aspects or calling methods on aspects. In this case you will see errors in the Java editor (although there will not be errors in the problems view). You may wish to either convert the file extension to .aj or use the AspectJ editor.

    To open a .java file with the AspectJ editor right click, then select Open With > AspectJ/Java Editor. To use the AspectJ editor for all .java files select Window > Preferences > Workbench > File Associations. Select .java in the right-hand window, then use the section below to change the default editor.

  7. What problems are there for types in .aj files?

    There are several known issues for types contained in .aj files.

    • They are not found when using code assist (Ctrl+Space).
    • They are not found when using add import (Ctrl+Shift+M).
    • They are not found when using organize imports (Ctrl+Shift+O).
    • There are no quick fixes available (Ctrl+1).
    • They are not included in Java searches.
    • They are not included in Call Hierarchy lists.
    • It is not possible to run JUnit tests written in .aj files.
    • Refactor > Move and drag and drop will not work for .aj files. Use Ctrl+C and Ctrl+V instead.
    • Refactor > Rename will not work for .aj files. Use Rename from the context menu instead.

  8. What happens if I write my aspects in .java files?

    AJDT does not support aspects written in .java files. Although the compiler will compile them correctly, you will find some loss of functionality in AJDT if you do use .java files for your aspects:

    • The Outline and Package Explorer views will not show aspects or their contents.
    • The Cross References view will not show any information for an aspect in a .java file, although it will show information for any classes advised by that aspect.

  9. How do I use Ant to build my AspectJ projects in AJDT?

    To use Ant to build an AspectJ project you need to use the iajc Ant task instead of the javac task. The definition of this is found in ajde.jar in the org.aspectj.ajde plug-in. In addition you will need some other plug-ins on the classpath. A simple example written for Eclipse 3.2.1 is shown below. Note that paths and version numbers will be different on different machines and different Eclipse versions. Using Ant independently from Eclipse will be slightly different - see the AspectJ development guide for more details and for more information about the iajc Ant task.

    <?xml version="1.0" encoding="UTF-8"?>

    <project name="My Project" default="build" basedir=".">

    <target name="init">
      <path id="ajde.classpath">
         <pathelement path="../../plugins/org.eclipse.core.resources_3.2.1.R32x_v20060914.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.osgi_3.2.1.R32x_v20060919.jar"/>
         <pathelement path="../../plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.equinox.registry_3.2.1.R32x_v20060814.jar"/>
         <pathelement path="../../plugins/org.eclipse.equinox.preferences_3.2.1.R32x_v20060717.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/>
         <pathelement path="../../plugins/org.eclipse.update.configurator_3.2.1.v20092006.jar"/>
         <pathelement path="../../plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.variables_3.1.100.v20060605.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.expressions_3.2.1.r321_v20060721.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/>
         <pathelement path="../../plugins/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
         <pathelement path="../../plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/>
         <pathelement path="../../plugins/org.aspectj.ajde_1.5.3.200610201049/ajde.jar"/>
         <pathelement path="../../plugins/org.aspectj.weaver_1.5.3.200610201049/aspectjweaver.jar"/>
         <pathelement path="../../plugins/org.aspectj.runtime_1.5.3.200610201049/aspectjrt.jar"/>
      </path>
      <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
         <classpath refid="ajde.classpath" />
      </taskdef>
    </target>

    <target name="build" depends="init">
      <delete dir="/bin"/>
      <mkdir dir="/bin"/>
      <path id="user.classpath">
         <!-- add additional classpath entries here -->
      </path>
      <!-- read additional ajc options from a file if required -->
      <property name="ajcArgFile" value=""/>
      <!-- fork the compiler -->
      <iajc destDir="/bin" failonerror="true" argfiles=""
         verbose="true" fork="true" maxmem="512m">
         <forkclasspath refid="ajde.classpath" />
         <forkclasspath refid="user.classpath" />
         <src path="src/"/>
      </iajc>
    </target>

    </project>

  10. Can I upgrade my AspectJ version?

    Upgrading the AspectJ version in an install of AJDT is not generally recommended because it is likely that different releases will not be compatible with each other. However we do plan to provide some scripts in the near future that will upgrade your AspectJ to a higher compatible version if available.

Extending

  1. How can I build tools which extend AJDT?

    See this Eclipsepedia page: Developer's guide to building tools on top of AJDT and AspectJ.

Contributing

  1. How can I contribute to the AJDT project?

    See the Developer FAQ

  2. Where will I find the source for AJDT?

    See the Developer FAQ

  3. How do I setup an AJDT development environment in Eclipse?

    See the Developer FAQ

  4. How can I package my sample code for contribution to the examples plug-in?

    See the Developer FAQ

Plans

  1. Where do I find out about future releases of AJDT?

    See the plans page for information about future releases.

  2. What new AJDT features are being worked on at the moment?

    See the task list on our project home page.