Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » How do I run a binary woven project?
How do I run a binary woven project? [message #1002988] Sun, 20 January 2013 02:07 Go to next message
Tinco Andringa is currently offline Tinco Andringa
Messages: 2
Registered: January 2013
Junior Member
Hi, I am not very comfortable in Eclipse so this might be a simple question.

I made two projects, one is an AspectJ project, the other a regular Java project.

In the regular Java project I have a method main, that just writes hello world to stdout.

In the AspectJ project I have defined an aspect that cuts into main with a before advice that prints out "Hello from AspectJ". I've tested this aspect, and it works on any main methods inside the AJ project.

Now I have added the Java project to the InPath, so the advice gets woven into that too. I enabled the information messages and it reports that it has successfully woven my advice.

Now when I run the Java project it does not say "Hello from AspectJ", I take it this is because it runs the non-woven files.

My question is: How do I run the woven version of the Java project? I see in my terminal that it is in bin/ of the AspectJ project, but I don't know how I would run it using the right classpath and such.
Re: How do I run a binary woven project? [message #1003650 is a reply to message #1002988] Mon, 21 January 2013 17:36 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 369
Registered: July 2009
Senior Member
You have two possibilities:

1. You are currently using the in path. Using in path will re-weave the binary files of the Java project into your AJ project (unless you provide a specific new location (ie- the in path out folder)). If you want to continue doing so, you will need to add these rewoven jars as a class file folder and run the main method from there (instead of the original main method). This is a bit complex if you are not familiar with Eclipse, so you should try #2.

2. Add the AJ project to the Aspect path of your Java project instead of using in paht/ You must convert your Java project into an AJ project (you do not need to change the code at all, just need to add the AJ nature, use the AJ compiler, and include the AspectJ rt jar at runtime, all this will be done automatically if you convert to an AJ project). When you do this, you can just run the main method of your original class. This is because the aspect path will include all aspects from the other project for weaving.
Re: How do I run a binary woven project? [message #1003705 is a reply to message #1003650] Mon, 21 January 2013 20:54 Go to previous message
Tinco Andringa is currently offline Tinco Andringa
Messages: 2
Registered: January 2013
Junior Member
Hi thanks for your reaction and your hard work on AspectJ Smile

I managed to get possibility 1 working. I used the Eclipse click-through run configuration tool to launch the class, but it generated a wrong qualified name for the class which was why I thought that didn't work.

I noticed it prefixed 'main.' before my qualified name, removed that and it worked.
Previous Topic:include JSP from other project
Next Topic:Aspectj LTW issue
Goto Forum:
  


Current Time: Sat Oct 25 20:46:03 GMT 2014

Powered by FUDForum. Page generated in 0.08782 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software