Using linked source folders

If you want to keep your aspects and your java code in separate projects, then one setup you can use is linked source folders:

  1. Ensure your java project has a source folder (rather than having it's source directly in the top level of the project)
  2. Create an AspectJ project which contains your aspects, again ensuring that it has a source folder
  3. Within your AspectJ project, define a second source folder and specify that it is a linked source folder. Either,
    1. Select the AspectJ project in the Package Explorer
    2. Select File > New > Folder
    3. Enter a name for your linked source folder
    4. Click Advanced
    5. Check link to folder in the file system and browse to the location of the source folder in your non-AspectJ project
    6. Click Finish
    or
    1. Select the AspectJ project in the Package Explorer
    2. Right click and select Properties
    3. Select Java Build Path in the list on the left of the properties page
    4. Click the Source tab
    5. Click Add Folder and then Create new Folder
    6. New Source Folder dialog will appear
    7. Enter a name for your linked source folder
    8. Click Advanced
    9. Check link to folder in the file system and browse to the location of the source folder in your non-AspectJ project
    10. Click OK to close the project properties dialog

When the AspectJ project is built, it will use the AspectJ project source and the source from the non-AspectJ project and produce a complete set of woven class files in the output directory of the AspectJ project.

The advantage of using this approach is that the navigation and crosscutting views available in AJDT will show how the advice in the aspects applies to the java project.

Related tasks
Using the inpath
Using the aspectpath

Legal notices