Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
AspectWerkz
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h3>Introduction</h3> <p>Since AspectWerkz 2.x an Eclipse plugin is provided. This one is largely a beta version, but in any way it will change your Eclipse project configuration, so it is safe to give it a try, come with feedback on the mailling lists and enrole for contribution.</p> <h3>Getting the AspectWerkz Eclipse plugin</h3> <p>Use the Eclipse manager to install from our update site.<br /> Open Eclipse, use the <strong>Help > Software Update > Find and Install</strong> menu.<br /> Select <strong>Search for new features to install</strong>.<br /> Click <strong>New remote site</strong><br /> Name it <strong>AspectWerkz</strong>, and use the following URL: *http://aspectwerkz.codehaus.org/downloads/eclipse*<br /> Follow the procedure to install it.</p> <p><img class="emoticon emoticon-tick" data-emoticon-name="tick" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/check.png" alt="(tick)" title="(tick)" /> The latest version is 2.0.4 for AW 2.0.RC1 and later, released on Déc 20, 2004.<br /> <img class="emoticon emoticon-tick" data-emoticon-name="tick" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/check.png" alt="(tick)" title="(tick)" /> Tested on Eclipse 3.0 and 3.1M4</p> <h3>Enabling / Disabling AspectWerkz IDE support</h3> <p>In the <em>package explorer</em>, open the Java project for which you want to activate the AspectWerkz IDE support.</p> <p>Right click on it. You should see a <strong>Enable AspectWerkz AOP</strong> menu. Select it.<br /> AspectWerkz IDE support will be from now on activated for this project.<br /> You can later on remove it by right-clicking again and using the <strong>Disable AspectWerkz AOP</strong> menu (if you do, tell us why !)</p> <p><img class="confluence-embedded-image" src="/download/attachments/231080175/01-enable.jpg?version=1&modificationDate=1369434972454" data-image-src="/download/attachments/231080175/01-enable.jpg?version=1&modificationDate=1369434972454" data-linked-resource-id="231375805" data-linked-resource-type="attachment" data-linked-resource-default-alias="01-enable.jpg" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231080175" title="null > 01-enable.jpg"></p> <p>The plugin is generating traces in the <strong>Error Log</strong> view. You can display it thru the menu <strong>Window > Show view > Error log</strong>.<br /> Some more log might be in the .metadata/*.log file in your Eclipse Workspace root.</p> <h3>Project dependencies</h3> <p>Since we are about to use AspectWerkz, the project should contains the AspectWerkz 2.x (at least 2.0.RC2) in its classpath and the dependencies (concurrent, trove, qdox and alike - see the distribution), and the AspectWerkz Java 1.4 jar file to deal with Java 1.4 annoations.<br /> Activating AspectWerkz support will not interfere with your configuration so you have to do it manually just as usual.</p> <p><img class="confluence-embedded-image" src="/download/attachments/231080175/02-projectsetup.jpg?version=1&modificationDate=1369434972450" data-image-src="/download/attachments/231080175/02-projectsetup.jpg?version=1&modificationDate=1369434972450" data-linked-resource-id="231375804" data-linked-resource-type="attachment" data-linked-resource-default-alias="02-projectsetup.jpg" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231080175" title="null > 02-projectsetup.jpg"></p> <h3>Annotation support</h3> <h4>Annotations</h4> <p>The plugin contains the AspectWerkz Java 1.4 annotation compiler. Annotations that you will write in JavaDoc and that are known by the framework (like <strong>@Before, @Expression, @Around</strong> etc) will be compiled as the code gets compiled (clean build, or incremental build when you save your Java file).</p> <p><img class="confluence-embedded-image" src="/download/attachments/231080175/03-annotationdriven.jpg?version=1&modificationDate=1369434972430" data-image-src="/download/attachments/231080175/03-annotationdriven.jpg?version=1&modificationDate=1369434972430" data-linked-resource-id="231375803" data-linked-resource-type="attachment" data-linked-resource-default-alias="03-annotationdriven.jpg" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231080175" title="null > 03-annotationdriven.jpg"></p> <h4>Custom annotations</h4> <p>AspectWerkz provides custom annotation support. For this to work in the plugin, it is mandatory to declare the annotations interface implementations just as usual in a dedicated file (see the documentation - <a class="external-link" href="http://aspectwerkz.codehaus.org/annotations.html#Compiling_Annotations" rel="nofollow">http://aspectwerkz.codehaus.org/annotations.html#Compiling_Annotations</a>).<br /> There are 2 requirements:</p> <ol> <li>the file(s) must in the <strong>project classpath</strong> (can be in the project itself or within a dependency jar file)</li> <li>the file(s) must (all) be named <strong>annotation.properties</strong></li> </ol> <p>A common practice is to have the project annotation.properties file in the <strong><project>/src/annotation.properties</strong> location.</p> <h3>AOP weaving</h3> <p>For weaving to occur, the system needs to know which class is an aspect. Just as usual, this is done<br /> thru the <strong>META-INF/aop.xml</strong> descriptor.<br /> There is no requirements for this part. You just need to have one or more META-INF/aop.xml file in your <strong>classpath</strong> - be it the project itself or within a dependency jar file that may contains bundled aspects.<br /> A common practice is to have the project aop.xml file in the <strong><project>/src/META-INF/aop.xml</strong> location.</p> <p>When you save a file, Eclipse will trigger a build that will trigger the weaving, based on the available META-INF/aop.xml file(s) and compiled annoation that defines the aspects</p> <h4>AOP cross cutting view support</h4> <p>When the weaving has occured, markers will display where advices are/may be applied using a gutter marker.</p> <p>The markers contain rich information that will inform you why there is a (or several) joinpoints on this specific line of source code.<br /> Hit <strong>CTRL + 1</strong> to make the <strong>Quick fix</strong> tips appear. It will show you which advice is affecting the joinpoint, and the type of advice (before / around / after returning / after throwing / after finally). If the information starts with a question mark "?" it means that the advice execution depends on a runtime check, like a "cflow" evaluation, or a "target is an instance of X" test.</p> <p><img class="confluence-embedded-image" src="/download/attachments/231080175/04-crosscutting.jpg?version=1&modificationDate=1369434972410" data-image-src="/download/attachments/231080175/04-crosscutting.jpg?version=1&modificationDate=1369434972410" data-linked-resource-id="231375802" data-linked-resource-type="attachment" data-linked-resource-default-alias="04-crosscutting.jpg" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231080175" title="null > 04-crosscutting.jpg"></p> <p>When you select an advice and hit <strong>RETURN</strong> you will jump to the source code of that advice if available.</p> <h3>Running your application from within Eclipse</h3> <p>You can decide to run the application just as a regular Java application, since the classes have been compiled by Eclipse thus weaved by the plugin.<br /> The META-INF/aop.xml files will be discovered at startup time, though you can point to a specific one using the "-Daspectwerkz.definition.file=.." JVM option as usual (see docs - <a class="external-link" href="http://aspectwerkz.codehaus.org/deployment.html" rel="nofollow">http://aspectwerkz.codehaus.org/deployment.html</a>)</p> <p>If you do, the dependancies in third parties jar file will not be weaved since those are not part of your Java project source code.<br /> To circumvent that, you should use AspectWerkz "online mode" ie load time weaving.<br /> The plugin provides a trick to make this easier to deal with.<br /> For it to work, you must add the Java <strong>tools.jar</strong> dependency to your project (it is in JAVA_HOME/lib/tools.jar)<br /> In the package explorer, right click on your "main class" that you would like to run.<br /> Select <strong>Run > Run...</strong><br /> Select the <strong>AspectWerkz Application</strong> configuration* style, right click and select <strong>New</strong>.<br /> Run it from there as you would do for any regular application.<br /> You should see a new line on system out: <em>AspectWerkz - INFO - Pre-processor org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor loaded and initialized</em> which confirms that the online mode is turned on.</p> <h3>Sample Eclipse project</h3> <p>To give it a try, you can use the sample project at <a class="external-link" href="http://aspectwerkz.codehaus.org/downloads/eclipse/aspectwerkz-eclipse-demo.zip" rel="nofollow">http://aspectwerkz.codehaus.org/downloads/eclipse/aspectwerkz-eclipse-demo.zip</a></p> <h3>Known issues in this beta.</h3> <p>When you modify an aspect, the weaving of target classes is not triggered thus the markers are not updated. You need to wait the next time you change your target class, or you need to trigger a clean build manually.</p> <p>When you trigger a clean build and the project contains both aspects and classes to be weaved, it may happen that the classes are not weaved. This happens when the aspect is defined with annotations, since the weaving of the target class may happen before the annotation compiler runs on the aspect. Trigger another clean build for now.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced