Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling error message dialog when running Eclipse in headless mode?

I'm trying to execute JUnit-tests through a headless Eclipse in our build process. The unit tests are invoked from an Ant script, with this command:

eclipsec.exe -noSplash -application org.eclipse.ant.core.antRunner -data "C:\SomeDirectory" -buildfile "C:\Path\To\tests.xml"

This works fine, unless the Ant script needs to fail for any reason (either via an explicit task because a unit test failed, or because a unit test threw an exception upstream). In either case, eclipsec raises a dialog box to report that "An error has occurred." This is accompanied by an exception. The top of the stack trace, if it is relevant, is:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.ant.core.AntRunner.run(AntRunner.java:513)
    at org.eclipse.ant.core.AntRunner.start(AntRunner.java:600)

I don't really care what the Ant script or Eclipse fails for -- that's what logging is for --, but the dialog box that pops up along with it is unacceptable, because it hangs our continuous integration system while it waits for the invisible user to come click on it.

Is there any way that this dialog box can be suppressed? Is there any way I can work around this dialog box that does not require a real user to respond to it?

Additional Info:

Eclipse Version: Indigo (latest as of yesterday). Ant and JUnit internal to it.

Java Version: JDK 6.0_30 32bit

OS: Windows (7 and Server 2003)

like image 326
Justin Aquadro Avatar asked Dec 15 '11 23:12

Justin Aquadro


1 Answers

If you are using subclasses of ErrorDialog, there is a static called AUTOMATED_MODE that you can set to true.

Turns out (see the comments below) that the error is coming from the wrapper program, exclipsec. Looking at the command line options here: http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html Specifying --launcher.suppressErrors on the command line will avoid this dialog (note the double dashes).

like image 122
Francis Upton IV Avatar answered Nov 04 '22 07:11

Francis Upton IV