!!! Please note that AspectJ now uses git repositories: AspectJ moves from CSV to GIT !!!
- 1 Obtain source code
- 2 Setting up Eclipse project
- 3 Using Ant to build modules
- 4 Running the tests
Obtain source code
You can obtain AspectJ source code either via CVS or a source jar file.
The source jar file is attached to every release you find on [AspectJ download page]. It can be simply unzipped.
If you want to access a specific branch or the latest trunk (head) code, you'll need to check it out via CVS.
You can perform the CVS via Eclipse (preferred way), or via a command line tool.
Checkout via Eclipse
In Eclipse open the "CVS Repository Exploring" perspective. From there click on "Add a CVS Repository", a dialog will display asking you properties for the CVS repository :
- "Use the repository identification string as the label" (isn't really necessary)
- Connection type: pserver
- User: anonymous
- Password: leave it blank
- Host: dev.eclipse.org
- Repository path: /cvsroot/tools
- "Use default port"
Click ok, and in the "CVS Repostiories" view on the left you should see the repository appear. Now you can navigate it as a tree, open :
- Head (for latest version, otherwise go to Tags for specific versions)
Now you should select all folders, except "aspectj-attic", right-click and then select "checkout as...". Eclipse will analyze the selected folder, and then suggest you to check out all the selected folders as "new java projects", click ok and wait for it to finish the checkout.
Checkout via command line
If you are able to use CVS via command line, then you'll have no problems using informations provided for Eclipse to perform your checkout, and then eventually update this wiki page with correct instructions :D
Setting up Eclipse project
If you are using Eclipse, once projects are in Eclipse, you'll need to set up a couple of classpath variables.
TODO : which classpath entries ?
Make sure that JAVA_HOME, your Eclipse workspace default JRE, and the JRE used in the "RunTheseBeforeYouCommitTests" launch configuration (see below) are all the same version of JRE, like all 1.5 or all 1.6, otherwise you will see strange exceptions about missing classes from the internal com.sun or javax.* packages.
Using Ant to build modules
AspectJ modules are built using Ant. Unfortunately, you are required to use the version 1.6.3 of Ant. Luckily AspectJ provides that version of Ant in the "lib" module.
Ant build files can be run from Eclipse or from command line. In both cases, you'll need to provide a build/local.properties files.
You can copy the build/developement.properties file, renaming it to local.properties file, and change the path of your JDK homes accordingly. Setting all the paths to a 1.5 or 1.6 JDK will work, in case you don't have all JDKs since 1.1 installed.
Ant from Eclipse
If you happen to have a 1.6.3 version of Ant, then you can simply run the build.xml files inside eclipse as usual.
If you have a newer version of Ant, for axample a 1.7.x, go to Window->Preferences and find the Ant->Runtime panel. Click on the "Ant home..." button on the left, and select the "lib/ant" directory. This will make Eclipse use the version of ant provided with AspectJ.
Ant from command line
If you have 1.6.3 installed in your system, you can simply type "ant" from inside any module to build it.
If you don't have ant installed in your system, then you can simply run ../lib/ant/bin/ant (or ant.bat) from inside any module to build it.
If you have ant installed however, you will see some warnings about two versions of ANT available inside JUnit, and some JUnit tests will fail.
On a linux box (and I supose on a Windows box too), you should set ANT_HOME to the AspectJ-Path/lib/ant/ directory, and then call ../lib/ant/bin/ant to build, so that it uses the right Ant version.
Running the tests
If you are using Eclipse, there is a pre-configured launch configuration that you'll find in the run menu, it is called "RunTheseBeforeYouCommitTests", and runs all the tests provided by AspectJ inside Eclipse itself.
Otherwise, you can use ant to run all the tests, simply type "../lib/ant/bin/ant test-run-all-junit-tests" (if using windows use ant.bat).
Problems running the tests
I get a NoClassDefFoundError : javax/tools/Domain
In Eclipse, make sure that JAVA_HOME, your Eclipse workspace default JRE, and the JRE used in the "RunTheseBeforeYouCommitTests" launch configuration are all the same version of JRE, all 1.5 or all 1.6. This is caused by AjDoc invoking the 1.6 (taken from JAVA_HOME) Javadoc class, which searches for 1.6 classes, but running in an 1.5 JRE.
junit.framework.AssertionFailedError: FAIL: pass rebuild minimal incremental purejava sourceroots test
These are tests in the testHarness that fail, they should not. This happened in Linux.