Skip to main content

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

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


Back to the top