If I put in a <script> which calls some other task and that task fails for some reason, the reason gets obscured by being wrapped in a ScriptException. As I was the one who wrote all the scripts in our builds, people immediately come to me, assuming that the script is at fault. The result of running a task via a script should mirror the result of running it directly. I suspect that this is just a matter of unwrapping the ScriptException to expose the real exception, but Ant is not printing the nested exception so it is not clear how much unwrapping would be needed.
Created attachment 26631 [details] Sample build file Attaching a trivial sample build script causing an error. The root cause message *is* included in the exception, but most users don't seem to scour it too well, and stop at "ScriptException". ------------ Result of running a task normally: $ ant run-normally Buildfile: /Users/daniel/Desktop/Test/Ant/build.xml run-normally: BUILD FAILED /Users/daniel/Desktop/Test/Ant/build.xml:10: Classname must not be null. Total time: 0 seconds ------------ Result of running the same task via a script: $ ant run-using-script Buildfile: /Users/daniel/Desktop/Test/Ant/build.xml run-using-script: BUILD FAILED /Users/daniel/Desktop/Test/Ant/build.xml:3: javax.script.ScriptException: sun.org.mozilla.javascript.internal.WrappedException: Wrapped Classname must not be null. (<Unknown source>#3) in <Unknown source> at line number 3 at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110) at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:124) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:108) at org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81) at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:104) at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:68) at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) 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:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.Main.runBuild(Main.java:801) at org.apache.tools.ant.Main.startAnt(Main.java:218) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Total time: 0 seconds
Forgot to set the issue to enhancement. Though the impact on myself is highly annoying since people are blaming me for their own screw-ups.