See:
http://marc.theaimsgroup.com/?l=ant-dev&m=98838238130156&w=2
Diane
--- Mark Womack <[EMAIL PROTECTED]> wrote:
> I did a little more digging into the exception. Line 206 in Ant.java is
> this:
>
> // Are we trying to call the target in which we are defined?
> if (p1.getBaseDir().equals(project.getBaseDir()) &&
> p1.getProperty("ant.file").equals(project.getProperty("ant.file"))
> &&
> target.equals(this.getOwningTarget().getName())) {
> throw new BuildException("ant task calling its own parent
> target");
> }
>
> I'm guessing, from looking at the surrounding code, that the
> p1.getBaseDir()
> call is returning null. This suggests that something is not set up
> correctly when calling the target from the <foreach> tag? My <project>
> has
> a basedir attribute of ".".
>
> I have tried embedding <echo> tags in the target called by foreach, but
> nothing gets printed. I tried other tasks besides javac, and they crash
> with the same error.
>
> So, I am stumped. I am using Ant 1.3. Is that an issue?
>
> Thanks,
> -Mark
>
> -----Original Message-----
> From: Mark Womack
> Sent: Monday, July 02, 2001 11:48 AM
> To: '[EMAIL PROTECTED]'
> Subject: Error with the foreach task
>
>
> This is probably something obvious that I am missing. But I have
> defined
> the following targets:
>
> <taskdef name="foreach"
> classname="org.apache.tools.ant.taskdefs.optional.ForeachTask"/>
> <target name="build_experimental" depends="init, prepare_dirs">
> <foreach target="build_experimental_dir" type="dir">
> <param name="src.subdir">
> <fileset dir="${build.java}" includes="*"/>
> </param>
> </foreach>
> </target>
>
> <target name="build_experimental_dir">
> <javac srcdir="${build.java}"
> destdir="${build.classes}"
> includes="${src.subdir}/*.java"
> classpath="${CLASSPATH}">
> <patternset excludesfile="${build.java}/build_excludes" />
> </javac>
> </target>
>
> Took me a while to figure out I needed to add the <taskdef>. But after
> adding that, I still get the following error:
>
> build_experimental:
>
> BUILD FAILED
>
> java.lang.NullPointerException
> at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
> at
> org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
> at
> org.apache.tools.ant.taskdefs.optional.ForeachTask.executeTarget(Fore
> achTask.java:246)
> at
> org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
> ForeachTask.java:263)
> at
> org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
> ForeachTask.java:273)
> at
> org.apache.tools.ant.taskdefs.optional.ForeachTask.execute(ForeachTas
> k.java:284)
> at org.apache.tools.ant.Target.execute(Target.java:153)
> at org.apache.tools.ant.Project.runTarget(Project.java:898)
> at org.apache.tools.ant.Project.executeTarget(Project.java:536)
> at org.apache.tools.ant.Project.executeTargets(Project.java:510)
> at org.apache.tools.ant.Main.runBuild(Main.java:421)
> at org.apache.tools.ant.Main.main(Main.java:149)
>
> It is unclear to me what is causing the null pointer exception. Is
> there
> something I can turn on in ant that will help me debug this? Does
> anyone
> see an obvious problem with the task definitions or the way I am using
> <foreach> that I am missing?
>
> Thanks!
> -Mark
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/