Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Trouble compiling java application with <iajc> task

Hello All,

My name is Marshall Meier. I currently support a medium-sized web application
for a local municipality. I would like to introduce aspects to the application,
beginning with logging.

The application is built using Ant (version 1.6). Before introducing any
aspects, I wanted to first build the application, as is, with the AspectJ
compiler (1.2). In the Ant script I swapped out the 'javac' task for the 'iajc'
task. Much to my chagrin Ant responded with several dozen compiler errors. Now,
when I changed the 'iajc' task back to 'javac', it compiled and built fine. I
am using the Sun JDK, 1.4.2_03.

When compiling with iajc, most of the classes compiled fine. However with a few
of them I would get:

[iajc] [error] "ClassA.java error The import ClassB cannot be resolved."

Where ClassA.java would import ClassB.java.

I'm confident my AspectJ installation works, as I have compiled and executed a
few sample aspects I've written.

Any ideas? Does AspectJ exhibit any different behavior than the Java compiler
when it comes to imports? I spent a few hours "Googling" for help, but was
unsuccessful. Below is the iajc task I used.

<iajc srcdir="${compile.src.dir}"
      destdir="${compile.classes.dir}" verbose="yes">
      <classpath refid="${compile.classpath}" />
      <classpath>
          <pathelement location="${lib.dir}/aspectjrt.jar" />
      </classpath>
      <patternset refid="${compile.files}" />
</iajc>

Also, here's how I get access to the 'iajc' task in the Ant script

<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"> 
  
        <classpath>
              <pathelement location="jars/aspectjtools.jar" />
        </classpath>
</taskdef>


- Marshall




Back to the top