Ankitraj-sharma opened a new pull request, #6871:
URL: https://github.com/apache/camel-k/pull/6871
<!-- Description -->
Fixes #6870
### Motivation
In newer runner images (and modern Maven 3.9+), Maven outputs the failure
summary banner `[ERROR] BUILD FAILURE` and divider lines `[ERROR]
------------------------------------------------------------------------` with
log level ERROR rather than INFO.
Because `pkg/util/command.go`'s `scan` records the first non-empty error
message returned by `LogHandler`, the generic banner `"BUILD FAILURE"` was
permanently recorded as the command's error message, shadowing the actual
informative failure reason that follows (e.g. `"The goal you specified requires
a project to execute but there is no POM in this directory"`). This caused
`TestRunAndLogErrorMvn` to fail with:
```
Error "BUILD FAILURE: exit status 1" does not contain "The goal you
specified requires a project to execute but there is no POM in this directory"
```
It also resulted in Maven failures in the builder (`pkg/builder/jib.go`)
reporting only `"BUILD FAILURE: exit status 1"` without the actionable error
reason.
### Modifications
- Updated `LogHandler` in `pkg/util/maven/maven_log.go` to ignore
non-diagnostic Maven banners (`BUILD FAILURE`, `BUILD ERROR`), separator lines
(`---...`), and execution summary timings (`Total time:`, `Finished at:`) so
that the actual root cause message is returned to the caller.
- Handled both `ERROR` and `FATAL` levels consistently with `normalizeLog`.
- In `pkg/util/maven/maven_log_test.go`:
- Added a skip check in `TestRunAndLogErrorMvn` if `mvn` is not present in
`PATH`.
- Added unit test `TestLogHandler` verifying banner and separator
filtering.
- Added unit test `TestLogHandlerMavenFailureSequence` verifying that the
informative error is correctly extracted from the Maven 3.9+ failure stream.
--
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]