Honour <follow> configuration element for start/run/watch (#1797)#1921
Open
JamBalaya56562 wants to merge 1 commit into
Open
Honour <follow> configuration element for start/run/watch (#1797)#1921JamBalaya56562 wants to merge 1 commit into
JamBalaya56562 wants to merge 1 commit into
Conversation
0e67b7e to
de1b8b3
Compare
…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
de1b8b3 to
2c246f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
followflag (block and stream container logs until interrupted) could only be enabled through thedocker.followsystem property. A<follow>element in the plugin<configuration>was silently ignored, because:StartMojo.followhad no@Parameterannotation, andStartMojo.followLogs()readSystem.getProperty("docker.follow")directly.WatchMojohad its own privatefollow()doing the same.So
docker:start/docker:run/docker:watchdid not honour<follow>in the POM (reported in #1797).Fix
followto@Parameter(property = "docker.follow"). It is a nullableBoolean(nodefaultValue) so the per-goal default can differ:followLogs()resolvesnull → false.followLogs()now resolvesnull → true, preservingdocker:run's "follow by default" behaviour.follow()method with a plain@Parameter(property = "docker.follow", defaultValue = "false")field (same idiom asLogsMojo).-Ddocker.followkeeps working unchanged, since Maven injects the user property into the annotated field (same mechanismLogsMojoalready uses). The resolved value still flows intoStartContainerExecutor, so the existing "show logs automatically when following" default is untouched.Tests
StartMojoTestcovers the resolution matrix:docker:startdefaults tofalse,docker:rundefaults totrue, and both honour an explicit<follow>value.936tests,0failures).Documentation (
startoverview) anddoc/changelog.mdupdated.Closes #1797
🤖 Generated with Claude Code