Jump to: navigation, search

Difference between revisions of "AJDT Developer FAQ"

(Launching AJDT Tests =)
 
(4 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
=== Where will I find the source for AJDT? ===
 
=== Where will I find the source for AJDT? ===
  
AJDT source is held in the Eclipse CVS repository under /cvsroot/tools, see the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ajdt/AJDT_src/?root=Tools_Project root of the AJDT source tree online]. AJDT is organized in subdirectories under org.eclipse.ajdt. The main source tree is in the “AJDT_src” subdirectory. Currently, the HEAD of this directory contains source code targeting Eclipse 3.6 (Helios). There are branches called e35 and e34 targeting Eclipse 3.5 and 3.4 respectively.  
+
AJDT source is available from git at http://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/.  The master branch is targeting Eclipse Indigo (3.7) and there is also an e36 branch that is targeting Eclipse Helios (3.6).
 +
 
 +
Historically, AJDT was available in CVS, and for earlier versions of AJDT, you will need to check the code out of the CVS repository in the Eclipse CVS repository under /cvsroot/tools, see the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ajdt/AJDT_src/?root=Tools_Project root of the AJDT source tree online]. AJDT is organized in subdirectories under org.eclipse.ajdt. The main source tree is in the “AJDT_src” subdirectory.  
  
 
The following Team Project Set files are available for Eclipse 3.6 and 3.5. To retrieve the source code for AJDT:  
 
The following Team Project Set files are available for Eclipse 3.6 and 3.5. To retrieve the source code for AJDT:  
+ Download the appropriate file  
+
* Download the appropriate file  
+ In your Eclipse workspace, select File -> Import -> Team project set  
+
* In your Eclipse workspace, select File -> Import -> Team project set  
+ Select the file  
+
* Select the file  
+ Wait...  
+
* Wait...  
  
 
[[Image:Ajdt35ProjectSet.psf|alt=ajdt 35 team project set]]
 
[[Image:Ajdt35ProjectSet.psf|alt=ajdt 35 team project set]]
  
 
[[Image:Ajdt36ProjectSet.psf|alt=ajdt 36 team project set]]
 
[[Image:Ajdt36ProjectSet.psf|alt=ajdt 36 team project set]]
 
  
 
=== How can I connect the AJDT CVS repository and download? ===
 
=== How can I connect the AJDT CVS repository and download? ===
  
 
Use the following credentials to connect to the repository anonymously:  
 
Use the following credentials to connect to the repository anonymously:  
+ connection type: pserver  
+
* connection type: pserver  
+ user: anonymous  
+
* user: anonymous  
+ password: ''blank''
+
* password: ''blank''
+ host: dev.eclipse.org
+
* host: dev.eclipse.org
+ path: /cvsroot/tools  
+
* path: /cvsroot/tools  
  
 
Note that this may not be necessary if you are using one of the team project set files above.
 
Note that this may not be necessary if you are using one of the team project set files above.
Line 46: Line 47:
 
=== Launching AJDT ===
 
=== Launching AJDT ===
  
+ Create a file called ''config.ini'' and save it somewhere in your workspace
+
* Create a file called ''config.ini'' and save it somewhere in your workspace
+ Add the following contents to the file:
+
* Add the following contents to the file:
  
 
  osgi.framework.extensions=org.eclipse.equinox.weaving.hook
 
  osgi.framework.extensions=org.eclipse.equinox.weaving.hook
Line 57: Line 58:
 
The first line ensures that the weaving service is properly hooked into the osgi runtime and the next three lines adds extra logging information to the console.
 
The first line ensures that the weaving service is properly hooked into the osgi runtime and the next three lines adds extra logging information to the console.
  
+ Create a new ''Eclipse Application'' launch configuration.
+
* Create a new ''Eclipse Application'' launch configuration.
+ Go to the ''Plugins'' tab
+
* Go to the ''Plugins'' tab
+ In the ''Launch with'' drop down, select ''plugins selected below only''
+
* In the ''Launch with'' drop down, select ''plugins selected below only''
+ In the list box below, find ''org.eclipse.equinox.weaving.aspectj''
+
* In the list box below, find ''org.eclipse.equinox.weaving.aspectj''
+ Change ''auto-start'' to ''true'' for that bundle
+
* Change ''auto-start'' to ''true'' for that bundle
+ In the ''Configuration'' tab, select ''Use an existing config.ini as a template''
+
* In the ''Configuration'' tab, select ''Use an existing config.ini as a template''
+ Choose the config.ini you created above.
+
* Choose the config.ini you created above.
+ Click ''Run''
+
* Click ''Run''
  
 
If weaving is enabled, you should see the following lines in your console view soon after launching:
 
If weaving is enabled, you should see the following lines in your console view soon after launching:
Line 72: Line 73:
 
After that, you should see many more weave-info messages as the JDT Weaving service spits out weaving messages to the console.  If you do not see these messages, then JDT Weaving is not enabled. It is possible to do some meaningful development work with AJDT with JDT weaving disabled, but some tests will fail and you will not be able to take advantage of AJDT's integration with JDT.
 
After that, you should see many more weave-info messages as the JDT Weaving service spits out weaving messages to the console.  If you do not see these messages, then JDT Weaving is not enabled. It is possible to do some meaningful development work with AJDT with JDT weaving disabled, but some tests will fail and you will not be able to take advantage of AJDT's integration with JDT.
  
== Launching AJDT Tests ===
+
=== Launching AJDT Tests ===
  
 
There are three top-level test projects:
 
There are three top-level test projects:
+ ''org.eclipse.ajdt.core.tests'': the AJDT core tests
+
* ''org.eclipse.ajdt.core.tests'': the AJDT core tests
+ ''org.eclipse.ajdt.ui.tests'': the UI tests for AJDT, the visualizer, and the cross references view
+
* ''org.eclipse.ajdt.ui.tests'': the UI tests for AJDT, the visualizer, and the cross references view
+ ''org.eclipse.contribution.weaving.jdt'': the Weaving tests for the JDT weaving service
+
* ''org.eclipse.contribution.weaving.jdt'': the Weaving tests for the JDT weaving service
  
 
To run these tests, create a new ''JUnit Plugin Test'' debug configuration and choose one of the projects above.  Then follow the instructions in the ''Launching AJDT'' section to ensure that JDT weaving is enabled when running your tests.
 
To run these tests, create a new ''JUnit Plugin Test'' debug configuration and choose one of the projects above.  Then follow the instructions in the ''Launching AJDT'' section to ensure that JDT weaving is enabled when running your tests.
Line 91: Line 92:
 
The ''org.eclipse.ajdt.examples'' plugin contains various sample projects which are made available under the Examples category of the New wizard, from where they can be imported into your workspace as AspectJ projects. It is easy to add new samples to this plugin, as follows:  
 
The ''org.eclipse.ajdt.examples'' plugin contains various sample projects which are made available under the Examples category of the New wizard, from where they can be imported into your workspace as AspectJ projects. It is easy to add new samples to this plugin, as follows:  
  
+ Create a jar file containing your source code, and at least one build configuration file. Place this in the archive folder of the examples plugin.  
+
* Create a jar file containing your source code, and at least one build configuration file. Place this in the archive folder of the examples plugin.  
+ Add an entry to the plugin.xml file for your sample project, by copying one of the existing entries.  
+
* Add an entry to the plugin.xml file for your sample project, by copying one of the existing entries.  
+ Change the src attribute of the import element to refer to your jar file, and change the title, description, pagetitle, and pagedescription property names as appropriate, and add corresponding entries to the plugin.properties file.  
+
* Change the src attribute of the import element to refer to your jar file, and change the title, description, pagetitle, and pagedescription property names as appropriate, and add corresponding entries to the plugin.properties file.  
+ Change the build attribute to refer to your default build configuration file. Your project may contain more configurations but the one specified here will be the one used to initially build the project.  
+
* Change the build attribute to refer to your default build configuration file. Your project may contain more configurations but the one specified here will be the one used to initially build the project.  
+ Optionally, you can specify an open attribute to the projectsetup element, which refers to a file, such as a README file, which is opened after the project has been imported to the workspace.  
+
* Optionally, you can specify an open attribute to the projectsetup element, which refers to a file, such as a README file, which is opened after the project has been imported to the workspace.  
  
 
=== How can I build tools which extend AJDT? ===
 
=== How can I build tools which extend AJDT? ===

Latest revision as of 00:44, 4 December 2011

AJDT is changing rapidly and so some of this document may be out of date. If you find anything that is out of date or you have any problems following these instructions, please send a note to the AJDT mailing list. We are a friendly bunch and want to encourage new developers to contribute to AJDT.

There are many ways to contribute to AJDT even if you are not developing code: answering questions (or asking them) on the mailing list, raising bugs and feature requests, submitting documentation and sample programs, and generally being a constructive member of the community. These are all ways you can help AJDT and AspectJ grow. Of course, we also appreciate code contributions.

How can I contribute to the AJDT project?

Your contributions to the AJDT project are strongly welcomed! You can create a patch that fixes a bug or provides an enhancement and submit it to the AJDT developers either as an attachment to a bug in Bugzilla, or as an attachment to a post to the newsgroup or developer mailing list. You can also contribute sample code showing interesting uses of AspectJ, by adding entries to the example plug-in. All contributions must be made available under the terms of the Eclipse website see the Eclipse contribution and participation FAQ. Sorry, but for legal reasons we are unable to accept patches emailed directly to developers, and will normally ask you to resubmit these either via Bugzilla or the mailing list. AJDT development is run as a meritocracy, developers who have a track record of submitting good patches can become committers on the project.

Setting up your workspace for AJDT

You need to start with a version of Eclipse that contains the RCP tools, which can be obtained on the Eclipse downloads page. Many of the plugins which implement AJDT contain aspects, and so are AspectJ projects themselves. This means that you first need to install a recent build of AJDT into your development environment from the update site or zip file.

Although not required, we recommend that you use a version of Eclipse that mirrors the version of AJDT that you are developing for. So, use an Eclipse 3.5 to develop AJDT targeting Eclipse 3.5.

AJDT provides optional Mylyn integration. If the target install of your Eclipse does not contain Mylyn, you will have errors in the org.eclipse.ajdt.mylyn.ui bundle. Unless you are actively developing Mylyn support, you can safely close that bundle.

The next step is to actually check out the source code.


Where will I find the source for AJDT?

AJDT source is available from git at http://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/. The master branch is targeting Eclipse Indigo (3.7) and there is also an e36 branch that is targeting Eclipse Helios (3.6).

Historically, AJDT was available in CVS, and for earlier versions of AJDT, you will need to check the code out of the CVS repository in the Eclipse CVS repository under /cvsroot/tools, see the root of the AJDT source tree online. AJDT is organized in subdirectories under org.eclipse.ajdt. The main source tree is in the “AJDT_src” subdirectory.

The following Team Project Set files are available for Eclipse 3.6 and 3.5. To retrieve the source code for AJDT:

  • Download the appropriate file
  • In your Eclipse workspace, select File -> Import -> Team project set
  • Select the file
  • Wait...

File:Ajdt35ProjectSet.psf

File:Ajdt36ProjectSet.psf

How can I connect the AJDT CVS repository and download?

Use the following credentials to connect to the repository anonymously:

  • connection type: pserver
  • user: anonymous
  • password: blank
  • host: dev.eclipse.org
  • path: /cvsroot/tools

Note that this may not be necessary if you are using one of the team project set files above.

Launching AJDT

  • Create a file called config.ini and save it somewhere in your workspace
  • Add the following contents to the file:
osgi.framework.extensions=org.eclipse.equinox.weaving.hook

aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true

The first line ensures that the weaving service is properly hooked into the osgi runtime and the next three lines adds extra logging information to the console.

  • Create a new Eclipse Application launch configuration.
  • Go to the Plugins tab
  • In the Launch with drop down, select plugins selected below only
  • In the list box below, find org.eclipse.equinox.weaving.aspectj
  • Change auto-start to true for that bundle
  • In the Configuration tab, select Use an existing config.ini as a template
  • Choose the config.ini you created above.
  • Click Run

If weaving is enabled, you should see the following lines in your console view soon after launching:

[org.eclipse.equinox.weaving.hook] info adding AspectJ hooks ...
[org.eclipse.equinox.weaving.aspectj] info Starting AspectJ weaving service ...

After that, you should see many more weave-info messages as the JDT Weaving service spits out weaving messages to the console. If you do not see these messages, then JDT Weaving is not enabled. It is possible to do some meaningful development work with AJDT with JDT weaving disabled, but some tests will fail and you will not be able to take advantage of AJDT's integration with JDT.

Launching AJDT Tests

There are three top-level test projects:

  • org.eclipse.ajdt.core.tests: the AJDT core tests
  • org.eclipse.ajdt.ui.tests: the UI tests for AJDT, the visualizer, and the cross references view
  • org.eclipse.contribution.weaving.jdt: the Weaving tests for the JDT weaving service

To run these tests, create a new JUnit Plugin Test debug configuration and choose one of the projects above. Then follow the instructions in the Launching AJDT section to ensure that JDT weaving is enabled when running your tests.

Trouble Shooting

If you are having problems starting your runtime workspace or running the tests, specifically, if Eclipse is in an infinite restart loop, see bug 235006.

Ask any more questions on the AJDT mailing list. We are happy to help out.

How can I package my sample code for contribution to the examples plug-in?

The org.eclipse.ajdt.examples plugin contains various sample projects which are made available under the Examples category of the New wizard, from where they can be imported into your workspace as AspectJ projects. It is easy to add new samples to this plugin, as follows:

  • Create a jar file containing your source code, and at least one build configuration file. Place this in the archive folder of the examples plugin.
  • Add an entry to the plugin.xml file for your sample project, by copying one of the existing entries.
  • Change the src attribute of the import element to refer to your jar file, and change the title, description, pagetitle, and pagedescription property names as appropriate, and add corresponding entries to the plugin.properties file.
  • Change the build attribute to refer to your default build configuration file. Your project may contain more configurations but the one specified here will be the one used to initially build the project.
  • Optionally, you can specify an open attribute to the projectsetup element, which refers to a file, such as a README file, which is opened after the project has been imported to the workspace.

How can I build tools which extend AJDT?

See: Developer's guide to building tools on top of AJDT and AspectJ.