Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Oct 30, 2025

Summary

When running integration tests, the Verifier dumps output to a log file (usually log.txt). This change adds the full command line used for execution at the beginning of the log file to make it easy to reproduce the test outside the IT environment.

Changes

  • Added formatCommandLine() method to generate human-readable command line representation
  • Modified execute() method to prepend command line information to log file after Maven execution
  • Includes comprehensive execution context: executable path, arguments, environment variables, JVM properties, working directory, and execution mode

Benefits

  • Easy Reproduction: Developers can copy the exact command line from log files to reproduce IT tests manually
  • Complete Context: All relevant execution context is captured for debugging
  • Non-Intrusive: Doesn't interfere with Maven's normal execution or logging
  • Error Handling: Failures in command line formatting don't break test execution

Example Output

# Command line used for this execution:
/opt/maven/bin/mvn -l log.txt --errors --batch-mode validate -Dtest.property=value
# Environment variables:
# TEST_ENV=test_value
# MAVEN_OPTS=-Duser.home=/path/to/user.home -Dsystem.prop=value
# MAVEN_SKIP_RC=true
# Working directory: /path/to/test/project
# Execution mode: AUTO

[INFO] Scanning for projects...
...

Testing

  • Compiled successfully with existing Maven build
  • Tested with simple and complex scenarios (custom arguments, system properties, environment variables)
  • Verified command line appears at beginning of log file
  • Confirmed no impact on normal Maven execution

Pull Request opened by Augment Code with guidance from the PR author

…oduction

When running integration tests, the Verifier dumps output to a log file (usually log.txt).
This change adds the full command line used for execution at the beginning of the log file
to make it easy to reproduce the test outside the IT environment.

The command line information includes:
- Full path to Maven executable with all arguments
- Environment variables (MAVEN_OPTS, MAVEN_SKIP_RC, custom env vars)
- JVM system properties
- Working directory
- Execution mode (EMBEDDED, FORKED, AUTO)

The information is prepended to the log file after Maven execution completes,
ensuring it appears at the top without being overwritten by Maven's logging.

Example output:
# Command line used for this execution:
/opt/maven/bin/mvn -l log.txt --errors --batch-mode validate
# MAVEN_OPTS=-Duser.home=/path/to/user.home
# Working directory: /path/to/test/project
# Execution mode: AUTO
The MavenITmng4387QuietLoggingTest was failing because it expects empty log files
when using the -q (quiet) flag, but the command line information was still being
added to the log file.

This change adds detection for quiet logging (-q or --quiet flags) and skips
adding the command line information when quiet logging is enabled, respecting
the intent of quiet logging to minimize output.

Changes:
- Added isQuietLogging() method to detect -q/--quiet flags
- Modified execute() to skip command line info when quiet logging is enabled
- Maintains full functionality for normal logging while respecting quiet mode
@gnodet gnodet added the build Pull requests that change the build process label Oct 30, 2025
@gnodet gnodet added this to the 4.1.0 milestone Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Pull requests that change the build process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant