mvnx 1.2.0

A clean and readable Maven wrapper for multi-module projects
Documentation
# mvnx

Maven wrapper written in Rust that provides clean and readable output for multi-module projects.

## Features

- **Clean output**: Shows only essential information
- **Reactor build order**: Shows the order modules are built in
- **Progress indicator**: Shows which module is being built currently
- **Build summary**: Shows:
  - Reactor build order
  - Module status (OK/FAIL) with time spent
  - Overall build status and total time spent
- **Test failure details**: Shows stacktraces for failed tests (from both `.txt` and XML reports)
- **XML-based error parsing**: Parses Maven Surefire XML reports for detailed error messages
- **Dad jokes**: Optional humor during the build
- **Clipboard copying**: Copies stacktraces to clipboard automatically

## Usage

The wrapper takes the same arguments as `mvn`:

```bash
# Basic build
mvnx clean install

# Skip tests
mvnx clean install -DskipTests

# Specific goal
mvnx clean test

# Custom settings
mvnx -s ~/settings.xml clean package
```

### Special flags

- `-h, --help`: Show help message
- `--mvnhelp`: Show Maven's help message (mvn --help)
- `-l, --log-file <file>`: Write all Maven output to the specified file
- `--clip`: Copy stacktrace to clipboard when exactly one test fails
- `-j`: Show dad jokes every 30 seconds during the build
- `-ji <seconds>`: Show dad jokes with custom interval (implies `-j`)

Examples:

```bash
mvnx clean install
mvnx --clip test
mvnx -l build.log clean install
mvnx -j clean install
mvnx -ji 20 test
mvnx --clip -j package
```

## Output Example

```
> Building module-a
> Building module-b

================================================================================
BUILD SUMMARY
================================================================================

Reactor Build Order:
  1. module-a
  2. module-b

Module Status:
  OK module-a [2.34s]
  OK module-b [5.67s]

Overall Status: OK SUCCESS
Total Time: 8.01s
Tests: 45 run, 43 passed, 2 failed

================================================================================
TEST FAILURES
================================================================================

[module-b]

--- TestFailureTest.txt ---
java.lang.AssertionError: Expected 42 but got 41
  at TestFailureTest.testSomething(TestFailureTest.java:15)

Stacktrace copied to clipboard.
```

## Testing

Run unit tests:

```bash
cargo test
```

The tests cover:
- Parsing reactor modules from Maven output
- Parsing module build start lines
- Parsing test result summaries
- Filtering stacktraces (removes framework lines, keeps user code)
- Parsing Maven Surefire XML reports for error messages and errors

## Installation

### From crates.io (recommended)

```bash
cargo install mvnx
```

This installs the latest release directly to your Cargo bin directory (typically `~/.cargo/bin`).

### Pre-built releases

Download pre-built binaries from the [GitHub releases page](https://github.com/leifjantzen/mvnx/releases) and add to your PATH:

```bash
# Download, extract, and install
wget https://github.com/leifjantzen/mvnx/releases/download/v1.1.0/mvnx-x86_64-unknown-linux-gnu
chmod +x mvnx-x86_64-unknown-linux-gnu
mv mvnx-x86_64-unknown-linux-gnu ~/.local/bin/mvnx
```

### Build from source

Clone the repository and build:

```bash
git clone https://github.com/leifjantzen/mvnx.git
cd mvnx
cargo build --release
```

The binary will be at `./target/release/mvnx`.

### Add custom build to PATH

If you built from source or want to use a custom location:

```bash
cp target/release/mvnx ~/.local/bin/
# or
sudo cp target/release/mvnx /usr/local/bin/
```

Then use it:

```bash
mvnx clean install
```

## How it works

The wrapper:
1. Starts Maven as a subprocess
2. Captures and parses its stdout output
3. Extracts key information:
   - Reactor module order
   - Module build progress
   - Build completion status and time spent
   - Test failure information
4. Parses Maven Surefire reports:
   - Reads `.txt` files for summaries
   - Reads `TEST-*.xml` files for detailed stacktraces and error messages
   - Filters out framework-related stacktrace lines
5. Shows a clean summary with error details
6. Exits with Maven's exit code

## Requirements

- Maven installed and available in PATH
- A clipboard tool:
  - `wl-copy` (Wayland)
  - `xclip` (X11)
  - `pbcopy` (macOS)

## Limitations

- Optimized for standard Maven output format
- Test failure parsing may need adjustment based on your test framework
- Requires `mvn` installed and in PATH