[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] How to prevent AJDT from weaving some class?
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Fri, 21 May 2010 09:19:25 -0700
- Delivered-to: firstname.lastname@example.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=2+j+cZQJopN4fs+xH08wujXSpL4CovbBcJRuSDsUuuc=; b=EUh9FlsieI4JFvlAsBjPszTqPWhtmWpN0wWMVUQnWq0kvt9Svg/uTkdTI3JJz0wAKm Dt0AU01qQidCX3DvvUjMhvTu9D3P22lI7Vtvz7pRM/bYP3XgvlxNc5903xIdKqWOiQLg cirigfk28gPOt/65QgKqnhucH8W+gzPXRcUAs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=CfqWLfu2sEmj87SsFgdLEgXnmV5AnQ17saqiuiseDa7QwbmX7pPS2rrr+1ZsKaLV9+ MHgDV4aiZA+FJwRqGw424tLgJ/rnWBTUxh6cTsM6HkEYh7EDx83AEBx8k0CvdPR6Yw5a BK1My1zhbzG8iW+jM4DT7I6dmCxpheUArHpaM=
I have already fixed the need to set -xmlConfigured this morning -
under bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=313936 - it
will now be set automatically for you.
The full build problem on aop.xml editing still needs an AJDT issue
On 21 May 2010 09:09, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:
> Hi Andy,
> The project is just for testing how to use aop.xml to avoid weaving JUnit
> test code. Sorry for packing all files in a hurry without finding the error
> in aop.xml.
> I use beforeAddNewData() advice to test the difference "call" and
> "execution". I'm still a newbie in AspectJ. Because I only call it in test
> code, the pointcut is "call", and aop.xml excludes the test code, not
> matching is exactly what I expected.
> Ok. I will do a full build in the future.
> I do need to set -xmlConfigured in my eclipse. How can I help to figure out
> where is wrong?
> Here is my AJDT version:
> AJDT Plugin Development Tools 2.0.2.e35x-20100105-0900
> On Fri, May 21, 2010 at 8:45 AM, Andy Clement <andrew.clement@xxxxxxxxx>
>> I'm afraid I have no idea what your project is supposed to do - you
>> didn't say. It builds for me and the tests all run. (there was an
>> syntax error in the aop.xml file I had to fix - it wasn't valid xml).
>> Should some piece of advice not be matching somewhere?
>> I found the beforeAddNewData() advice in the MyAspect was not matching
>> anything, when I remove the scope setting in aop.xml then it starts
>> matching the testcode, when I add the scope setting back into the
>> aop.xml then it stops matching the testcode - that seems the right
>> behaviour?? What do you see differently to that?
>> You will need to do full builds between edits on the aop.xml file, we
>> don't support incremental compilation with aop.xml editing. So I see
>> a few issues that you should raise as bugs:
>> -xmlConfigured should be turned on automatically. That code is
>> already in AspectJ, if it isn't working, that is a bug. You don't
>> need to set it in the IDE.
>> a full build should be kicked off for any edit/save of an aop.xml file
>> actively in use on the aop.xml management page. This is an AJDT
>> On 20 May 2010 12:14, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:
>> > I found what was wrong when I switched to aop.xml management: I didn't
>> > add
>> > -xmlConfigured into "Project properties->AspectJ
>> > Compiler->Other->Non-standard compiler options". After adding it, the
>> > project is compiled correctly.
>> > Then both of changes exclude my Junit test classes from weaving:
>> > <aspect name="MyAspect" scope="!com.foo.bar.Test.*Test"/>
>> > and
>> > <weaver>
>> > <exclude within="com.foo.bar.Test.*Test"/>
>> > </weaver>
>> > I also did a test. If I remove -xmlConfigured, the project cannot be
>> > compiled correctly. src/test/java/com/foo/bar/Test/AjdtWeavingTest.java
>> > is
>> > not compiled. The files under src/main/java are compiled, but not be
>> > weaved.
>> > I attached my project here. Not sure if this is a bug.
>> > Thanks a lot.
>> > On Thu, May 20, 2010 at 11:45 AM, Andy Clement
>> > <andrew.clement@xxxxxxxxx>
>> > wrote:
>> >> > It seems that AJDT tries to weave all classes in a project by
>> >> > default.
>> >> > I attached files in a test project.
>> >> yes
>> >> > When I use "call" for pointcuts of interface Addable in MyAspect,
>> >> > AJDT
>> >> > tries
>> >> > to weave the interface calls of the mock object. Sometimes I don't
>> >> > want
>> >> > the
>> >> > advices in my unit test code, for example, advices from the log
>> >> > aspect.
>> >> > How can I prevent AJDT from weaving junit test case classes?
>> >> You can set the within clauses for your aspect to exclude the
>> >> testcode. Or you can try out aop.xml management:
>> >> > If I add aop.xml into project properties->AspectJ Builder->aop.xml
>> >> > Management, some wired things happens:
>> >> >
>> >> > all aspectj advice markers are gone. You need to clean the project
>> >> > first,
>> >> > otherwise you may see the markers are still there.
>> >> When you switch to using aop.xml files to control the builder you are
>> >> switching from the default mode of 'all aspects included' to an opt-in
>> >> model where only those specified in your aop.xml file are included.
>> >> It is a bug that there wasn't a clean when you made the switch (want
>> >> to raise it?)
>> >> This feature is intended to help users developing aop.xml files that
>> >> they will later use for load-time weaving, hence the switch to opt-in.
>> >> > if you clean the project "Project->clean...", only the files under
>> >> > src/main/java are compiled, src/test/java are not compiled.
>> >> Don't really understand that - the choice of aop.xml shouldn't affect
>> >> what gets compiled... is there an entry in the error log saying why
>> >> compilation failed?
>> >> > remove aop.xml from aop.xml management, everything comes back.
>> >> When you had switched to aop.xml management and defined an aop.xml
>> >> file that mentioned the aspects you wanted woven, did it weave
>> >> anything?
>> >> aop.xml management is the feature you want, it allows you to set a
>> >> scope for an aspect so that you could avoid weaving your tests with
>> >> your aspects.
>> >> <aspect name="MyAspect" scope="!com.foo.tests..*"/>
>> >> aop.xml management is still under development right now.
>> >> Andy
>> >> _______________________________________________
>> >> 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 mailing list