slachiewicz opened a new pull request, #13892: URL: https://github.com/apache/maven/pull/13892
Maven 3.9.x counterpart of #13888. Maven only needs colored log output, and JAnsi brought a native library and a `System.out`/`System.err` replacement for what is a handful of escape codes. With this change the distribution ships no native library. - maven-embedder provides `org.fusesource.jansi.Ansi`, `AnsiConsole`, `AnsiPrintStream` and `AnsiMode` (the classes from #13888 and #13727). `Ansi` writes the escape sequences itself; `AnsiConsole.systemInstall()` only counts calls and never replaces `System.out`. Core's own maven-shared-utils and every plugin's bundled copy link these four classes and nothing else from JAnsi, so they keep working unchanged. - `AnsiTerminal` detects whether stdout is an ANSI capable terminal (`System.console()`, `Console.isTerminal()` on Java 22+, `TERM=dumb`). `MavenCli` turns color on in `auto` mode only when a terminal was detected, so embedded runs stay plain (#13357) and `--color=always` still forces color there. - `extension.xml` exports the four classes by name instead of `org.fusesource.jansi.*`, and keeps `org.fusesource.jansi:jansi` excluded so a plugin that declares JAnsi gets these classes. - Distribution: the `jansi` jar, `lib/jansi-native` and `-Dlibrary.jansi.path` in `mvn` and `mvn.cmd` are gone. Behavior changes: - On Windows, `auto` colors only in consoles known to handle ANSI (Windows Terminal, ConEmu, ANSICON, VS Code, or `TERM` set). In the old console (conhost), use `--color=always`; JAnsi's translation of escape codes to console API calls is what the native library did, and it is not replaced. - Git Bash/mintty is usually not detected as a terminal, so output is plain unless `--color=always` is given. - Escape codes written by plugins themselves are no longer stripped when output is piped; Maven's own output never had any when color was off. - `getTerminalWidth()` reads `COLUMNS`, then `stty size` on Unix terminals; otherwise -1. `src/site/resources/images/maven-deps.svg` still shows JAnsi; the image is generated and is left for a separate update. apache/maven-shared-utils#451 drops the JAnsi dependency on the library side as well; this change does not depend on it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
