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