Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Aspectj only works on annotations when they are in the same project? (using OSGI)

I changed my build so that my woven code is put in a separate folder, which my build step now uses. I still can't get my aspect to work though, but this seems like a good idea anyways.

(answer to you last paragraph)
A is on the classpath of B. I am able to get B to see my annotation without any trouble. I am not sure what an eclipse builder step is, so I believe I am not using one. I am doing everything from the command line and just using eclipse as an editor. Here is where my iajc ant call lives:

       <target name="compile">
		<mkdir dir="${bin.dir}" />
		<javac srcdir="src" destdir="${bin.dir}" debug="true">
			<classpath refid="classpath" />
		</javac>
		<mkdir dir="${woven.bin.dir}" />
		<iajc inpath="${bin.dir}" destdir="${woven.bin.dir}" aspectPath="${blueprint.home}/plugins/undo_1.0.0.jar" debug="true">
			<classpath refid="classpath" />
		</iajc>
		<copy todir="${woven.bin.dir}">
			<fileset dir="src" excludes="**/*Test.java" />
		</copy>
	</target>


Also, is what I am trying to do possible? I've gotten an aspect to work that intercepts system.out.println in other bundles, but this annotation based one is killing me :(
________________________________________
From: aspectj-users-bounces@xxxxxxxxxxx [aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement [andrew.clement@xxxxxxxxx]
Sent: Friday, July 09, 2010 2:36 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Aspectj only works on annotations when they are    in the same project? (using OSGI)

i'd be very cautious about specifying the output folder to be the same
as the input folder:  inpath="${bin.dir}" destdir="${bin.dir}"

it isn't like aspectj pre-loads all the code ready to do a weave, you
might get very strange results with that.  how about:
inpath="${bin.dir}" destdir="${woven.bin.dir}"

I presume, although your annotation is in bundle A that you are using
it in bundle B?  I got that impression.  If that is the case, how is
the code in B compiling unless A is on the classpath?  You aren't
using an Ant step defined as an eclipse builder step are you?  The
iajc is something that is running later?

Andy

On 9 July 2010 09:55, Kashtan, Daniel <Daniel.Kashtan@xxxxxxx> wrote:
> I hope I can explain everything correctly.
>
> I have my aspect in bundle A. My join points are in bundle B. My annotation is in bundle A, but I am not even sure if this matters at all. My ant compilation for bundle B has an aspect path dependency I believe, I use this iajc tag:
>
> <iajc inpath="${bin.dir}" destdir="${bin.dir}" aspectPath="${blueprint.home}/plugins/undo_1.0.0.jar" debug="true">
>        <classpath refid="classpath" />
> </iajc>
>
> I have another aspectj function in my .aj file in bundle A. This one works, which is why I think the usage of annotations is somehow causing the problem.
>
>        void around() : call(void java.io.PrintStream.println(String))
>        && !within(HelloAspect){
>                System.out.println("Hi from HelloAspect ;-)");
>        }
>
> ________________________________________
> From: aspectj-users-bounces@xxxxxxxxxxx [aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement [andrew.clement@xxxxxxxxx]
> Sent: Friday, July 09, 2010 11:55 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Aspectj only works on annotations when they are    in the same project? (using OSGI)
>
> Hi,
>
> How does your code containing the join points compile if you don't
> have the annotation in the same project that is using it?  Do you have
> a classpath dependency (maybe an aspectpath dependency) from the join
> point containing project to the aspectj project?  I would need to know
> how the annotation is being used in the code-to-be-woven and what
> relationships you have between the projects.
>
> Andy
>
> On 9 July 2010 07:19, Kashtan, Daniel <Daniel.Kashtan@xxxxxxx> wrote:
>> Hey all,
>>
>> I am using compile-time-weaving and OSGI. I cannot figure out why, but my aspects don't work unless my annotation file is in the same project where my join points are. Basically, I have gotten the aspect below to work if my aspect is in one project, and my annotation and java code with join points are in another. I'd like to move my annotation file into the same project as the one with the aspect, but my aspects will stop working then :(
>>
>> I am using aspect code like this:
>>
>>        after() : call(@CommitingFunction * *(..))
>>        {
>>                System.out.println("Commit clicked");
>>        }
>>
>> My annotation is simply just this:
>>
>> @Retention(RetentionPolicy.RUNTIME)
>> public @interface CommitingFunction
>> {
>>
>> }
>>
>> This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
>> Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top