From Eclipsepedia

Jump to: navigation, search



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.

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?

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.


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.

Are there any newsgroups for AJDT users?

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

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.

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

What version of AJDT do I need?

The recommended version of AJDT depends on the version of Eclipse that you are using. Eclipse 3.4 requires AJDT 1.6, Eclipse 3.3 requires AJDT 1.5, and Eclipse 3.2 requires AJDT 1.4 (etc.). Typically, the latest development version is just as stable as our official releases (we never release anything unless anything unless it passes all tests). You can find the latest development release as well as all of the official AJDT release from the AJDT downloads page.

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.

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.

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 (Windows/Linux), or Eclipse > Preferences > AspectJ > Compiler (Mac). Select the Advanced tab, then check No inline and click OK to apply.

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.

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 > General > File Associations (Windows/Linux), or Eclipse > Preferences > General > File Associations (Mac). Select .java in the right-hand window, then use the section below to change the default editor.

What are the limitations of the AspectJ Editor?

Although similar, using the AspectJ editor is not exactly the same as using a Java editor. Besides an AspectJ editor providing AspectJ-related capabilities, there is some functionality that it does not provide, but the Java editor does. For example, override/implement gutter markers are not shown.

If there is some functionality that is missing from AspectJ editors that is present in Java editors, please mention it on the mailing list or raise a bug for it.

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.

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"/>
 <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
 	  <classpath refid="ajde.classpath" />


<target name="build" depends="init">

 <delete dir="/bin"/>
 <mkdir dir="/bin"/>
 <path id="user.classpath">
 <property name="ajcArgFile" value=""/>
 <iajc destDir="/bin" failonerror="true" argfiles=""
 	  verbose="true" fork="true" maxmem="512m">
 	  <forkclasspath refid="ajde.classpath" />
 	  <forkclasspath refid="user.classpath" />
 	  <src path="src/"/>



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.


How can I build tools which extend AJDT?

See Developer's guide to building tools on top of AJDT and AspectJ.


How can I contribute to the AJDT project?

See the Developer FAQ

Where will I find the source for AJDT?

See the Developer FAQ

How do I setup an AJDT development environment in Eclipse?

See the Developer FAQ

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

See the Developer FAQ


Where do I find out about future releases of AJDT?

See the plans page for information about future releases.

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

Look for open AJDT bugs in bugzilla or ask a question to the mailing list. We are a friendly bunch and are happy to answer your questions.