I keep bumping into the issue I documented in bug
50894<https://issues.apache.org/bugzilla/show_bug.cgi?id=50894>but
there's no feedback about it. Here's the description:
Using this build file:
<project>
<target name="foo" depends="aug">
<echo message="${toString:p}" />
</target>
<target name="bar" depends="aug">
<echo message="${toString:p}" />
</target>
<path id="p" />
<target name="aug">
<augment id="p">
<path>
<pathelement path="/" />
</path>
</augment>
</target>
</project>
I can invoke each target, foo and bar, independently; for example
ant foo
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml
aug:
foo:
[echo] C:\
BUILD SUCCESSFUL
ant bar
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml
aug:
bar:
[echo] C:\
BUILD SUCCESSFUL
However, invoking both on the same command line causes an error:
ant foo bar
Buildfile:
C:\dev\projects\ant-playground\augment-with-multiple-target\build.xml
aug:
foo:
[echo] C:\
aug:
BUILD FAILED
C:\dev\projects\ant-playground\augment-with-multiple-targets\build.xml:14:
java.lang.NullPointerException
at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:376)
at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:344)
at org.apache.tools.ant.Task.maybeConfigure(Task.java:202)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
If foo and bar independently use augment, even for the same path (that is,
they
don't use depends on a shared target) like this:
<project>
<target name="foo">
<augment id="p">
<path>
<pathelement path="/" />
</path>
</augment>
<echo message="${toString:p}" />
</target>
<target name="bar">
<augment id="p">
<path>
<pathelement path="/" />
</path>
</augment>
<echo message="${toString:p}" />
</target>
<path id="p" />
</project>
the build works.
Any help getting this resolved would be much appreciated. I've tried
debugging it myself but I get lost somewhere in the deep, dark underbelly of
Ant.
Rich