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 270593

Summary: ANSI colors no longer work as of Maven 3.5.0 (Maven 3.3.9 works fine)
Product: projects Reporter: _ gtzabari <gtzabari>
Component: MavenAssignee: Tomas Stupka <tstupka>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 10   
Issue Type: DEFECT Exception Reporter:

Description _ gtzabari 2017-05-09 06:20:58 UTC
Testcase:

String greenBold = "\033[32;1m";
String reset = "\033[0m";
System.out.println("before" + greenBold + " green " + reset + "after");

1. If you run the above program against Maven 3.3.9, the word "green" will render using a green color inside the Netbeans output tab.
2. If you run the same program against Maven 3.5.0, no colors will show up.

I know that Maven 3.5.0 shipped with this feature related to ANSI colors: https://issues.apache.org/jira/browse/MNG-3507

The question is: is this a bug in Netbeans, Maven, or the integration between the two?
Comment 1 _ gtzabari 2017-05-09 07:14:57 UTC
I think I figured out the underlying problem.

Maven 3.5.0 integrated jansi into its core.
jansi tries to detect the terminal capability and if it doesn't think that the terminal support ANSI codes, it strips them out of the output.

Looking at https://github.com/fusesource/jansi/blob/master/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java#L111 I can confirm that I am running under Windows, not under cygwin, nor under mingw. Therefore, it is logical to assume the jansi strips color codes in this case.

Furthermore, if I set MAVEN_OPTS to "-Djansi.passthrough=true" colors *do* work.

Therefore, I propose that either we add special Netbeans-detection to jansi, or update the Netbeans integration to pass "-Djansi.passthrough=true" to Maven.
Comment 2 _ gtzabari 2017-05-09 07:19:21 UTC
Filed https://github.com/fusesource/jansi/issues/87