Skip to content

Commit 8324fe9

Browse files
committed
fix: improve Maven output formatting with batch mode
1 parent 43ad0cb commit 8324fe9

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

docs/docs/commands/dev.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ haft dev serve --no-interactive
116116

117117
| Build Tool | Run Command | Compile Command (for restart) |
118118
|------------|-------------|-------------------------------|
119-
| Maven | `mvn spring-boot:run -DskipTests` | `mvn compile -DskipTests -q` |
119+
| Maven | `mvn spring-boot:run -DskipTests -B` | `mvn compile -DskipTests -q -B` |
120120
| Gradle | `./gradlew bootRun -x test` | `./gradlew classes -x test -q` |
121121

122+
Note: The `-B` flag enables Maven batch mode for cleaner output formatting.
123+
122124
---
123125

124126
## Plugin Integration

internal/cli/dev/process.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,20 @@ func (pm *ProcessManager) Restart(ctx context.Context) error {
295295
pm.restartCount++
296296
pm.mu.Unlock()
297297

298-
fmt.Fprintln(pm.stdout, "\n\033[33m→ Compiling...\033[0m")
298+
fmt.Fprintln(pm.stdout, "\n\033[33m─────────────────────────────────────────\033[0m")
299+
fmt.Fprintln(pm.stdout, "\033[33m→ Compiling...\033[0m")
299300

300301
if err := pm.Compile(ctx); err != nil {
301-
fmt.Fprintf(pm.stderr, "\033[31m✗ Compilation failed: %v\033[0m\n", err)
302+
fmt.Fprintf(pm.stderr, "\n\033[31m✗ Compilation failed: %v\033[0m\n", err)
302303
fmt.Fprintln(pm.stdout, "\033[33m→ Keeping current server running\033[0m")
304+
fmt.Fprintln(pm.stdout, "\033[33m─────────────────────────────────────────\033[0m")
303305
pm.mu.Lock()
304306
pm.setState(StateRunning)
305307
pm.mu.Unlock()
306308
return err
307309
}
308310

309-
fmt.Fprintln(pm.stdout, "\033[32m✓ Compilation successful\033[0m")
311+
fmt.Fprintln(pm.stdout, "\n\033[32m✓ Compilation successful\033[0m")
310312
fmt.Fprintln(pm.stdout, "\033[33m→ Stopping server...\033[0m")
311313

312314
pm.mu.Lock()
@@ -320,6 +322,7 @@ func (pm *ProcessManager) Restart(ctx context.Context) error {
320322
}
321323

322324
fmt.Fprintln(pm.stdout, "\033[33m→ Starting server...\033[0m")
325+
fmt.Fprintln(pm.stdout, "\033[33m─────────────────────────────────────────\033[0m")
323326

324327
return pm.Start()
325328
}
@@ -337,7 +340,7 @@ func (pm *ProcessManager) buildRunCommand() (string, []string) {
337340

338341
func (pm *ProcessManager) buildMavenRunCommand() (string, []string) {
339342
executable := getMavenExecutable()
340-
args := []string{"spring-boot:run", "-DskipTests"}
343+
args := []string{"spring-boot:run", "-DskipTests", "-B"}
341344

342345
if pm.profile != "" {
343346
args = append(args, fmt.Sprintf("-Dspring-boot.run.profiles=%s", pm.profile))
@@ -381,11 +384,11 @@ func (pm *ProcessManager) buildGradleRunCommand() (string, []string) {
381384
func (pm *ProcessManager) buildCompileCommand() (string, []string) {
382385
switch pm.buildTool {
383386
case buildtool.Maven:
384-
return getMavenExecutable(), []string{"compile", "-DskipTests", "-q"}
387+
return getMavenExecutable(), []string{"compile", "-DskipTests", "-q", "-B"}
385388
case buildtool.Gradle, buildtool.GradleKotln:
386389
return getGradleExecutable(), []string{"classes", "-x", "test", "-q"}
387390
default:
388-
return getMavenExecutable(), []string{"compile", "-DskipTests", "-q"}
391+
return getMavenExecutable(), []string{"compile", "-DskipTests", "-q", "-B"}
389392
}
390393
}
391394

0 commit comments

Comments
 (0)