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 - ANSI colors no longer work as of Maven 3.5.0 (Maven 3.3.9 works fine)
Summary: ANSI colors no longer work as of Maven 3.5.0 (Maven 3.3.9 works fine)
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-09 06:20 UTC by _ gtzabari
Modified: 2018-12-30 05:57 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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