| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <title> |
| Deploying an AspectJ plug-in |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| </head> |
| <body> |
| <h1> |
| Deploying an AspectJ plug-in |
| </h1> |
| |
| <p>AspectJ plug-ins can either be build through the <b>Export Plug-ins and Fragments |
| with AspectJ Support</b> Wizard or with an Ant build script. To use the wizard:</p> |
| <ol> |
| <li>Select <strong>File > Export... > Deployable plug-ins and fragments with AspectJ support</strong>.</li> |
| <li>Select the plug-ins and fragments you want to export. </li> |
| <li>You can deploy the plug-ins in one of three formats: |
| <ul> |
| <li>a single ZIP file whose content can be unzipped into any Eclipse-based |
| product.</li> |
| <li>a directory structure, so the destination of the export operation can be |
| the root of an Eclipse installation.</li> |
| <li>individual JAR archives for an Update site. This option will |
| result in the creation of one JAR per plug-in, and the JARs will be placed |
| in a plugins/ subdirectory of the chosen destination.</li> |
| </ul> |
| </li> |
| </ol> |
| |
| <p> The following issues apply to plug-ins that advise classes in a JAR:</strong> |
| <p> 1. The wizard does not translate your |
| <strong>project</strong> build path to your <strong>plug-in</strong> classpath. This can result |
| in a build failure (which will appear as an error in the build.xml file generated by the export wizard) |
| if your plug-in includes aspects that advise classes in a JAR. This is still the case even if the JAR is |
| in your project structure and on its build path. To avoid this problem, you must manually add the JAR to |
| the plug-in classpath, making it available to the export wizard, and the plug-in itself at runtime. |
| You can do this on the Runtime tab of the plugin.xml editor. Click the "Add..." button in the classpath |
| section and add the JAR, then save plugin.xml. The export should now complete without error. |
| |
| <p> It is also worth noting that this problem does not occur when the plug-in is run/debugged from |
| Eclipse; in this case the additional JARs/classes <strong>will</strong> be picked up. |
| |
| <p> 2. In fixing your classpath, as described above, your plug-in will pick up the versions of the classes |
| which your aspects advise, but not the woven versions. The files exported by default are as follows: |
| <ul> |
| <li>The class file corresponding to each source file (Java class or Aspect) in the project</li> |
| <li>JAR files, properties files and anything else that doesn't need to be compiled </li> |
| </ul> |
| This does <strong> not </strong> include the woven versions of classes in JARs (advised by |
| the aspects in the project) as there is no corresponding Java source file. These woven classes <strong>do |
| </strong> exist in the project structure, in the project's output directory (as shown in the Navigator view).</p> |
| |
| <p> In order for your exported plug-in to use the <strong>woven</strong> versions of classes from JARs in your |
| project you must add the output directory to the plug-in's build configuration. You can do this in the "Runtime |
| Information" section of the "Build Configuration" page of the plugin.xml editor. By default, there is a single |
| library called "." with a corresponding "src/" folder. Click the "Add Folder" button on the right and select the |
| "bin/" folder (or whatever your output folder is called). The exported plug-in will now use the woven |
| versions of any classes from the JAR file. |
| |
| <p>See <a href="newpluginbuildfile.htm">Creating an Ant build file for an AspectJ plug-in</a> |
| for details on how to deploy a plug-in using an Ant build file. |
| </p> |
| |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"> |
| </p> |
| <p> |
| <a href="newplugin.htm">Creating a new AspectJ plug-in project</a><br> |
| <a href="convertpluginproject.htm">Converting a plug-in project to an AspectJ project</a><br> |
| <a href="newpluginbuildfile.htm">Creating an Ant build file for an AspectJ plug-in</a> |
| </p> |
| |
| </body> |
| </html> |
| |