gnodet commented on PR #13955:
URL: https://github.com/apache/maven/pull/13955#issuecomment-6854917226
<!-- ForgeBot:review -->
## CI Failure Analysis
After investigating the failing integration tests, here's what I found:
### Root cause
All 6 failing ITs share the same underlying cause:
**`doConfigureWithTerminal` now runs synchronously on the main thread _before_
plugins execute**, replacing `System.out` with a `LoggingOutputStream`. On
`master` this was racy — the `FastTerminal` background thread often ran _after_
plugins had already printed, so `System.out` was still the original stream.
With the PR, plugin `System.out.println()` calls now flow:
```
System.out (LoggingOutputStream)
→ stdout logger
→ terminal writer (DeferredTerminal → DumbTerminal)
→ original stdout FD (captured as log-stdout.txt)
```
But when `-l log.txt` is in use, the logger's writer points to the log file.
The `LoggingOutputStream` routes through the logger → **log file**, while
`verifyTextInLog` on those ITs checks the IT verifier's captured stdout file —
leading to output ending up in the wrong place.
### Specific failures (confirmed from the uploaded CI artifacts):
| Test | What the IT log shows |
|---|---|
| **mng-7160, mng-5382, mng-6084, mng-8648, mng-13068** | Plugin stdout IS
produced (found in `log-stdout.txt`), but `verifyTextInLog` checks `log.txt`
which no longer contains plugin `System.out` output |
| **mng-8445 case [15] (color-always)** | Native DI registry dump goes via
`LoggingOutputStream` → SLF4J logger → ANSI escape codes are **stripped** → the
`ANSI_STYLE.matcher(line).find()` assertion fails |
### Evidence
From `mng-5382/log-stdout.txt` (exists, correct):
```
Hello! I am a component that is being used via constructor injection! That's
right, I'm a JSR330 badass.
```
From `mng-5382/log.txt` (what `verifyTextInLog` checks): text is absent.
For `color-always`: `CheckMojo` lines in log.txt have no ANSI codes (`[INFO]
[stdout] candidate: @Named("") org.apache.maven.its.mng8445.CheckMojo...`),
because SLF4J strips them.
### Fix needed
The `doConfigureWithTerminalWithRawStreamsDisabled` path's
`LoggingOutputStream` strips ANSI and reroutes plugin stdout through the SLF4J
logger. This breaks two things:
1. ANSI-colored output from DI diagnostics (color-always case)
2. Tests that use `verifyTextInLog` and expect plugin stdout in the IT
verifier's captured output
One option: for the non-`-l` case, have the `LoggingOutputStream` tee to
both the logger AND the original `System.out` (pre-wrapping). For the `-l`
case, ensure the raw terminal output is also captured where `verifyTextInLog`
can find it.
Another option: delay calling
`doConfigureWithTerminalWithRawStreamsDisabled` or skip it for the common
non-embedded CLI case — keep `System.out` writing directly to the terminal for
plugin output, only routing Maven's own logger output through the terminal.
--
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]