Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW, javaagent, JUnit and ANT integration

Hi

The option is "-javaagent:externals/aspectjweaver.jar" (not -Djavaagent)
(this is an error in the doc that has been reported and will be fixed
next time we upgrade the doc).

When using LTW, you can compile with javac, and / or ajc (ajc makes
most sense for the .aj files unless there are also some components
that you would like to weave at compile time f.e. client side things
etc).
If you do weave with ajc and are planning to use LTW, you must use the
-Xreweavable option in ajc (that might be the default in 1.5 final) -
or you 'll have explicit message.

-verbose  and -showWeaveInfo should print something with LTW
Another option that can help is a -Daj.weaving.verbose=true on the
command line to see some lines of log before we actually figure that
you asked for -verbose in the aop.xml file(s). This can be usefull
when f.e. you are not sure if your aop.xml file(s) is/are taken into
account.

All that will appear in the next docs.
Alex


On 8/9/05, Valerio Schiavoni <ervalerio@xxxxxxxxxx> wrote:
> I need to use LTW in my project.
> This is the ant task when i launch testcases:
> 
> <target name="test" depends="compile" description="Junit testings">
>     <junit fork="yes" printsummary="withOutAndErr" haltonfailure="no">
>        //
>        MORE JVM ARGS
>        //
>         <jvmarg value="-Djavaagent=externals/aspectjweaver.jar"/>
>         <formatter type="plain" usefile="false"/>
>         <classpath refid="classpath"/>
>         <test name="org.aormf.tests.AllTests" todir="${build.report.dir}"/>
>     </junit>
> </target>
> 
> I'm using the jvmarg for declaring the path to the aspectjweaver jar.
> 
> In the case of LTW, standard Java files and AspectJ files must be
> compiled by the same compiler (ajc) ?
> Or, i can compile java files with javac and aspects with ajc ?
> 
> Following the developer's book, i did a simple aop.xml:
> <aspectj>
>     <aspects>
>         <!-- declare an existing aspect to the weaver -->
>         <aspect name="org.aormf.aspects.ExecutionMonitorAspect"/>
>     </aspects>
>     <!--any include given, all types knows by the weaver are woven-->
>     <weaver options="-1.5 -verbose -XlazyTjp -showWeaveInfo" />
> </aspectj>
> 
> Since i'm not getting any info about weaving, i suppose it is not working.
> THe concrete aspect declared in the aop descriptor is very simple:
> 
> package org.aormf.aspects;
> public aspect ExecutionMonitorAspect {
>     // intercept a call to an managed resource
>     pointcut annotatedResourceInvocation():
>             call(* *(..)) && @annotation(MemberOfMonitoredSet);
> 
>     before(): annotatedResourceInvocation(){
>        System.out.println("Intercepted call");
>     }
> }
> 
> Does this aspect should be compiled somewhere else?
> 
> Am i confusing it all ?...
> 
> 
> thanks for any clarification
> Valerio
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top