Version 1.2 and version 1.3 provide an improved development environment for AspectJ
AspectJ Development Tools for Eclipse (AJDT) has recently undergone considerable changes, mainly integrating with the Eclipse platform in a more comprehensive manner. This change provides AspectJ developers with more access to the tools supported on the Eclipse platform. In this article, I'll cover AJDT 1.2, which applies to Eclipse 3.0, which was released in June this year and will cover AJDT 1.3 for Eclipse 3.1, which will be released this September (now you can get the early development builds Version).
AJDT has changed a lot since AJDT 1.1, so this article is useful for new contacts AJDT and developers who are familiar with earlier versions. In this article, I do not want to repeat what has changed and how these changes have occurred, but rather to look at the current AJDT features and technologies in a new perspective.
Throughout this article, I use a few common scenarios to explore the features of AJDT. All scenarios will reflect the activities typical AspectJ developers experience; For example, the first scenario involves how to create a simple AspectJ project from scratch (one of the most common things developers get to know about AspectJ or start to become familiar with languages and tools). More in-depth scenarios include adding to existing Java projects and dealing with a wide variety of multiple project environments. I will also discuss specific support for the new features in AspectJ 5 and take you through the process of migrating from AJDT 1.1. Finally, when summarizing this article, I will briefly describe the AJDT development process itself (that is, the development of AJDT with AJDT) and some of the changes you can take part in the future.
Note that AJDT 1.2 is the latest stable release for Eclipse 3.0, which replaces AJDT 1.1.12, while AJDT 1.3 is a stable release for Eclipse 3.1. The Milestone version of AJDT 1.2 and the development builds version are already available for Eclipse 3.1, but a separate version branch is required to implement the stable release for Eclipse 3.1, so AJDT 1 appears. 3. In addition to what is specifically noted, everything described in this article applies to two versions of the branch. The main difference is that AspectJ 5-specific features, which typically require Eclipse 3.1.
See Resources for a download of the current version of the AJDT and Eclipse platforms. Both need to be downloaded to run the examples in this article.
Learn AJDT from the beginning
For Java developers who are just starting to touch AspectJ, it's a good idea to write some simple AspectJ programs. You can do this by using the examples in the AspectJ Programmer's Guide, or by using a number of excellent AspectJ books or articles (see the Resources section). The process of creating a new AspectJ project in Eclipse is similar to creating a Java project: simply select File > New > Project > AspectJ Project, or use the new AspectJ on the toolbar Project shortcuts. The rest of the wizard is basically the same as the New Java Project Wizard.
In fact, the AspectJ project is a Java project (from Eclipse's point of view, it has a Java nature in addition to its AspectJ nature), so any tools and plug-ins that can be used on a Java project can also be manipulated on a AspectJ project. The key difference is the Eclipse builder that is used to compile the project: The AspectJ compiler is used to replace the JDT Java compiler. The AspectJ compiler is an extension of the JDT compiler, so it is entirely possible to compile Java code.
In the next section, I'll describe some of the AJDT features that play a role in a simple development scenario.
New Aspect Wizard
Because AspectJ projects are very similar to Java projects, I don't need to explain how to create source folders, packages, and classes, or how to configure the project's classpath-which should be natural for most Eclipse Java developers (see Resources for information on ECL Ipse for more information). Similarly, the experience of editing a class is the same as before: You can still use the Java editor, and you will find that some features that can greatly save time (like content aids, quick fixes, and organization imports) still work.
So we'll go directly to the next step: creating aspects. Aspect is a modular unit of AspectJ that has much in common with classes in the Java language. Please select File > New > Other > AspectJ > Aspect or use the new Type Drop-down list on the toolbar to open the New Aspect Wizard, which is very similar to the new Class Wizard, with only a few options 。