Summary
Simple configuration settings for putting your aspects into a different project than your primary project(s).
Advertisement
Here's the original message:
Subject: [aspectj-users] AJDT - cross-project weaving in WSAD
Hi All,
I need some help with AJDT 1.1.4 used with AspectJ 1.2 in WSAD 5.1.0. (Eclipse 2.x)
Below is an answer to a former question:
Suppose you have Project A which is pure Java and Project B that is AspectJ. You want to apply your aspects from Project B to Project A. You open the ProjectProperties for Project B and add a new source folder (through the java build path tab). When you add the source folder, make it a linked source folder that points to the source folder for ProjectA.
When setup this, ProjectA can build as a pure java project. When you build ProjectB it will apply your aspects to the source from ProjectA and the resulting output will be put into the bin directory for ProjectB.
I'm interested in doing the same thing and I tried the suggestion. Unfortunately, I'm unable to define a linked source folder. Actually, according to the WSAD help about linked source files, there should be a dialog with an advanced option to specifiy that a source folder is actually a link to a source folder within another project. I don't even see the Advanced button.
Any explanation, idea, suggestion?
Thanks,
Jean-Luc Libioulle
And my reply:
My solution is as follows:
Convert Project A to an aspect project.
In Project B's "Project Properties->AspectJ Compiler" tab, set the "Output jar" field
In Project A's "Project Properties->AspectJ Compiler" tab, set the "Input jars (aspects)" field to point to the output jar from Project B (above).
Build Project B
Build Project A
A coworker has something similar, but prefers to keep the .class files in the bin\ directory of Project B. It requires using the "Zip Creation" plugin.
Convert Project A to an aspect project.
In Project B's "Project Properties->Zip Creation" tab set all the appropriate fields (I'm not familiar with the tool so can't provide specifics).
In Project A's "Project Properties->AspectJ Compiler" tab, set the "Input jars (aspects)" field to point to the output jar from Project B (above).
Build Project B
Build Project A
One point of caution: make sure that in "Project Properties->Java Build Path->Libraries" tab, that none of your libraries are using variables. It appears that the 1.1.4 + 1.2 versions have problems converting the variables to their absolute paths.
I read the same WSAD 5.1 help documentation and was just as annoyed to find the missing 'Advanced' button. As it turns out, this button is by default disabled. This is not a WSADism, but instead an Eclipse feature.
The feature was added in Eclipse 2.1.
To enable the Source Folder Advanced button to allow linking to folder in file system you must check the 'Enable Linked Resources' setting in 'Windows->Preferences->Workbench->Linked Resources'.
I don't believe this is covered in WSAD help, I found it in the eclipse 2.1 help system.