This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 192299 - Output exceptions using System.err when running with Ant.
Summary: Output exceptions using System.err when running with Ant.
Status: RESOLVED INVALID
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 7.0
Hardware: PC All
: P4 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-22 20:01 UTC by converginglight
Modified: 2010-11-29 21:01 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
JUnit test case output, ant verbosity is NORMAL, exception is VISIBLE (56.28 KB, image/png)
2010-11-22 20:09 UTC, converginglight
Details
JUnit test case output, ant verbosity is QUIET, exception is INVISIBLE (42.85 KB, image/png)
2010-11-22 20:10 UTC, converginglight
Details

Note You need to log in before you can comment on or make changes to this bug.
Description converginglight 2010-11-22 20:01:17 UTC
When Ant output verbosity is set to "Quiet", exceptions are not shown during "run" or "test".

This is not consistent:

setting Ant's verbosity to "Quiet" makes Ant display only warnings and errors (or more general: everything that goes to System.err).

Exceptions ARE errors. They should be displayed even if verbosity is "Quiet".
Comment 1 converginglight 2010-11-22 20:05:27 UTC
Sorry, the RFE applies only to execution of JUnit tests.

Consider the following code:

= = = = = = = = = =
CODE
= = = = = = = = = =


import org.junit.*;

public final class _NBRunWithException {

	// doing "run" does display this exception
	public static void main(String... args) {
		throw new Error("Dear Ant, please display this, even when verbosity is 'Quiet'");
	}

	// doing "test" does NOT display this exception
	@Test
	public void test() {
		throw new Error("Dear Ant, please display this, even when verbosity is 'Quiet'");
	}

}
Comment 2 converginglight 2010-11-22 20:09:46 UTC
Created attachment 103206 [details]
JUnit test case output, ant verbosity is NORMAL, exception is VISIBLE
Comment 3 converginglight 2010-11-22 20:10:14 UTC
Created attachment 103207 [details]
JUnit test case output, ant verbosity is QUIET, exception is INVISIBLE
Comment 4 Jesse Glick 2010-11-23 00:58:43 UTC
This is just what Ant itself does, easily reproducible by passing -q on the command line.

The Test Results window shows the full stack trace.

I do not recommend setting verbosity to Quiet. It is more there for completeness with other settings such as Verbose and Debug useful on occasion for debugging complex builds.
Comment 5 converginglight 2010-11-23 01:09:32 UTC
By setting Ant to "Quiet" I just wanted to get rid of too verbose output during actions such as clean+build, which for 90% consists of:

init:
deps-clean:
"Created dir" [...]
"Updating property file" [...]
SomeProject.init:
SomeProject.deps-clean:
"Updating property file" [...]
"Deleting directory" [...]
SomeProject.clean:
[...]

(Even worse, when you have many dependent projects)

Any ideas, how this can be reduced (workaround and/or another RFE)?

Thank you!
Comment 6 Jesse Glick 2010-11-23 01:16:00 UTC
If you're just interested in running unit tests with Compile on Save checked, you do not need Clean & Build. Otherwise, there is no recommended way of reducing verbosity for regular builds. (More targets could have been prefixed with '-' in nbproject/build-impl.xml but it is too late to make such changes without endangering compatibility for existing projects with overrides in build.xml.)
Comment 7 converginglight 2010-11-27 18:32:27 UTC
Understand...

Could an option be added to Options/Misc/Ant/... which would reduce only Netbeans-originating output? Wouldn't break any compatibility.
Comment 8 converginglight 2010-11-27 18:34:27 UTC
Why I am interested in reducing clean+build output: I do clean+build a lot because of generative code (either custom, or produced during annotation-processing).
Comment 9 Jesse Glick 2010-11-29 21:01:59 UTC
"Updating property file" and "Deleting directory" are emitted by Ant. deps-clean etc. are target names, which as previously mentioned probably cannot be changed now. It would be possible to write an AntLogger impl in a plugin which would hide some of this output for the case of Java SE projects, but I do not plan to do it.