Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "AspectJBuild"

(New page: = 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 [[http://www.eclipse.org/aspe...)
 
Line 14: Line 14:
  
 
* "Use the repository identification string as the label" (isn't really necessary)
 
* "Use the repository identification string as the label" (isn't really necessary)
* Connection type : pserver
+
* Connection type: pserver
 
* User: anonymous
 
* User: anonymous
 
* Password: leave it blank
 
* Password: leave it blank
 
* Host: dev.eclipse.org
 
* Host: dev.eclipse.org
* Repository path : /cvsroot/tool
+
* Repository path: /cvsroot/tool
 
* "Use default port"
 
* "Use default port"
  
Line 37: Line 37:
  
 
TODO : which classpath entries ?
 
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.
 +
 +
= Running the tests =
 +
 +
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.
 +
 +
== Problems running the tests ==
 +
 +
=== I get a NoClassDefFoundError : javax/tools/Domain ===
 +
 +
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. TODO find why they fail.
 +
 +
 +
 +
= 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.
 +
 +
== 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.

Revision as of 21:12, 25 March 2010

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/tool
  • "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)
    • org.aspectj
      • modules

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

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.

Running the tests

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.

Problems running the tests

I get a NoClassDefFoundError : javax/tools/Domain

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. TODO find why they fail.


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.

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.

Back to the top