Category Archives: aspectj

When Run Ant Script, AspectJ does not Import Aspect source folder out side java classes?

I create simple Ant Script to compile my AspectJ Project. Java file compile well under <Javac> tag witch out compile using aspectJ. But when compiling Aspectj (.aj) file, it gives error not import java class. (`iajc - tag pass import error'). My aspect.aj file import some .java classes in other modules.

This is my build.xml file

  <target name="init"  >
     <!-- Create the build directory structure used by compile -->
     <mkdir dir="${build}/classes"/>

  <target name="resolve" depends="init" >
     <!-- Compile the java code from ${src} into ${build}/classes -->
     <javac  srcdir="${src}" destdir="${build}/classes"  includeantruntime="false"  />

  <taskdef resource="org/aspectj/tools/ant/taskdefs/">
      <pathelement location="${lib}/aspectjtools-1.8.6.jar"/>

  <target name="compile.aspectj"  depends = "resolve"  > 
     <iajc destDir="${build}/classes"   >
                 <pathelement location="${src}/bank_aspect" />              

                <pathelement location="${lib}/aspectjrt-1.8.6.jar"/>

My folder structure show below image and all aspect file content under bank_aspect folder.

enter image description here

This is the error, coming when I run 'Ant' command in Command Promt.

enter image description here

Could you help me to avoid this error?