Skip to content

Honour <follow> configuration element for start/run/watch (#1797)#1921

Open
JamBalaya56562 wants to merge 1 commit into
fabric8io:masterfrom
JamBalaya56562:fix-1797-follow
Open

Honour <follow> configuration element for start/run/watch (#1797)#1921
JamBalaya56562 wants to merge 1 commit into
fabric8io:masterfrom
JamBalaya56562:fix-1797-follow

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Problem

The follow flag (block and stream container logs until interrupted) could only be enabled through the docker.follow system property. A <follow> element in the plugin <configuration> was silently ignored, because:

  • StartMojo.follow had no @Parameter annotation, and StartMojo.followLogs() read System.getProperty("docker.follow") directly.
  • WatchMojo had its own private follow() doing the same.

So docker:start / docker:run / docker:watch did not honour <follow> in the POM (reported in #1797).

Fix

  • StartMojo: bind follow to @Parameter(property = "docker.follow"). It is a nullable Boolean (no defaultValue) so the per-goal default can differ: followLogs() resolves null → false.
  • RunMojo: followLogs() now resolves null → true, preserving docker:run's "follow by default" behaviour.
  • WatchMojo: replace the ad-hoc follow() method with a plain @Parameter(property = "docker.follow", defaultValue = "false") field (same idiom as LogsMojo).

-Ddocker.follow keeps working unchanged, since Maven injects the user property into the annotated field (same mechanism LogsMojo already uses). The resolved value still flows into StartContainerExecutor, so the existing "show logs automatically when following" default is untouched.

Tests

  • New StartMojoTest covers the resolution matrix: docker:start defaults to false, docker:run defaults to true, and both honour an explicit <follow> value.
  • Full unit-test suite green (936 tests, 0 failures).

Documentation (start overview) and doc/changelog.md updated.

Closes #1797

🤖 Generated with Claude Code

@JamBalaya56562 JamBalaya56562 force-pushed the fix-1797-follow branch 2 times, most recently from 0e67b7e to de1b8b3 Compare July 5, 2026 08:44
…1797)

The follow flag could only be set via the docker.follow system property:
StartMojo.followLogs() and WatchMojo read System.getProperty(...) directly
and the follow field had no @parameter, so a <follow> element in the plugin
<configuration> was silently ignored.

Bind follow to @parameter(property = "docker.follow") on StartMojo (nullable
Boolean so RunMojo can keep its default of true while start/watch default to
false) and on WatchMojo, resolving the per-goal default in code. -Ddocker.follow
keeps working since Maven injects it into the field.

Closes fabric8io#1797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow settings ingored unless specified from command line

1 participant