Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] More than one execution of <iajc> task in same Ant session resulting in "Unable to find aspectjtools to fork"

I'm not sure what to say.

You're right that it should work.  I just checked
doc/examples/build.xml in 1.5.3.  That build script forks
and builds a number of examples in one ant session without
complaint.  You can even do "ant bean bean" to redo the
same example.

Maybe try resolving the path to aspectjtools.jar; I'm
wondering if the current working directory changes during
the Ant session (though I don't remember that happening in
Ant).

It might help if you inspect or trap the exception being
thrown to see if the task is checking the right absolute
location (in which case the resource is busy) or the path
is wrong (in which case the working directory is changing).
 I'll look into updating the exception message to include
the current working directory.

Sorry not to be of more help -
Wes


On Wed, 29 Nov 2006 14:06:15 -0500
 "Mulligan, Tim" <Timothy.Mulligan@xxxxxxx> wrote:
> Newbie to AspectJ - but spent a good amount of time
> looking through the
> AspectJ <iajc> ant task documentation and the
> aspectj-users mail list
> archives.  Here is my issue.  I'm using the <iajc> Ant
> task (AspectJ
> 1.5.2).  Everything works fine when/if the <iajc> task is
> only executed
> once per Ant session (i.e. when a single target is
> specified on ant
> commandline, say 'ant build', resulting in one invocation
> of <iajc>
> task.  However I'm getting "unable to find aspectjtools
> to fork - tried
> ../lib/aspectjtools.jar" when the <iajc> task is executed
> more than once
> per Ant session (i.e. when multiple targets are specified
> on ant
> commandline, say 'ant build test', resulting in more than
> one invocation
> of the <iajc> task.  I'm certain the solution lies in the
> forkclasspath
> attribute of the <iajc> task based on what I've read, but
> so far I have
> been unable to get it working as prescribed.  I tried
> copying
> aspectjtools.jar into Ant's lib but did not help.  I've
> included
> relevant sections of my Ant build script (note that the
> 'test' target
> depends on 'build-test' which depends on 'build').  For
> now, I've added
> an up-to-date/check target to determine if the [2nd]
> build is necessary
> which avoids the issue but I wouldn't consider this a fix
> (more a
> workaround).  Any tips or pointers would be much
> appreciated.
> 
> > Relevant sections/snippets of Ant build script:
> >     <target name="set-path">
> >         <path id="aspectj.classpath">
> >             <pathelement
> location="../lib/aspectjtools.jar"/>
> >         </path>
> >         <path id="project.classpath">
> >             <pathelement location="."/>
> >             <pathelement location="${classes}"/>
> >             <pathelement path="${depends.jdk.libs}"/>
> >             <pathelement
> location="../lib/aspectjrt.jar"/>
> >         </path>
> >     </target>
> > 
> >     <!-- build -->
> >     <target name="build" depends="set-paths"
> description="Compile
> > source files">
> >         <taskdef
> >
>
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"
> >                  classpathref="aspectj.classpath"/>
> >         <iajc fork="true"
> >             deprecation="off"
> >             debug="true"
> >             X="noInline"
> >             destdir="${classes}"
> >             classpathref="project.classpath"
> >             forkclasspathref="aspectj.classpath"
> >             <sourceroots>
> >               <pathelement location="${sources}"/>
> >               <pathelement location="${resources}"/>
> >             </sourceroots>
> >         </iajc>
> >     </target>
> > 
> >     <!-- dist -->
> >     <target name="dist" depends="build"
> description="Create
> > distribution files">
> >         <jar jarfile="${distdir}/${jarfile}"
> > manifest="${tmp.manifest.file}">
> >             <fileset dir="${classes}">
> >                 <include name="**/*"/>
> >             </fileset>
> >             <fileset dir="${src.config.dir}">
> >                 <include name="**/*.*"/>
> >             </fileset>
> >         </jar>
> >     </target>
> > 
> >     <!-- build-test -->
> >     <target name="build-test" depends="build">
> >         <javac destdir="${test.classes}"
> >             deprecation="off"
> >             debug="${debugmode}"
> >             classpathref="project.class.path"
> >             fork="yes"
> >             executable="${javac.location}"
> >             compiler="${javac.version}">
> >             <src path="${test.src.dir}" />
> >         </javac>
> >     </target>
> > 
> >     <!-- test -->
> >     <target name="test" depends="build-test"
> description="Run unit
> > tests">
> >         ... (emma)
> >         <junit fork="yes" haltonfailure="no"
> printsummary="on">
> >             <formatter type="xml"/>
> >             <formatter type="brief" usefile="false"/>
> >             <test name="${test.entry}"
> todir="${test.results.dir}"/>
> >             <classpath>
> >                 <pathelement
> location="${out.instr.dir}"/>
> >                 <path refid="emma.lib"/>
> >             </classpath>
> >             <classpath refid="project.class.path"/>
> >             <classpath refid="runtime.class.path"/>
> >             <jvmarg
> >
>
value="-Demma.coverage.out.file=${coverage.dir}/coverage.ec"/>
> >             <jvmarg
> value="-Demma.coverage.out.merge=false"/>
> >             <jvmarg value="-Dlog.dir=${log.dir}"/>
> >         </junit>
> >         ... (junitreports)
> >         ... (emma reports)
> >     </target>
> > 
> > For now, I added a 'check' to determine if the build is
> necessary
> > which avoids the problem.
> >     <target name="is.build.necessary">
> >         <uptodate property="build.unnecessary"
> > targetfile="${distdir}/${jarfile}">
> >             <srcfiles dir="${sources}"
> includes="**/*.java **/*.aj" />
> >             <srcfiles dir="${resources}"
> includes="**/*.java **/*.aj"
> > />
> >         </uptodate>
> >     </target>
> > 
> >     <!-- build -->
> >     <target name="build" depends="post-process,
> is.build.necessary"
> > unless="build.unnecessary"
> >         ...
> > 
> > Thank you,
> > Tim Mulligan



Back to the top