Skip to content

Fix #424: mvnw respects -q/--quiet for the wrapper's own diagnostics - #474

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:fix/424-mvnw-respect-quiet
Open

arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:fix/424-mvnw-respect-quiet

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

-q/--quiet had no effect on the wrapper itself (e.g. DefaultDownloader's "insecure connection" warning) — Logger.warn() always wrote to stderr unconditionally, because MavenWrapperMain never looked at its own forwarded arguments before printing anything, only Maven does once it starts.

Added MavenWrapperMain.isQuiet(args), a plain scan for -q/--quiet matching Maven's own CLI, called at the very start of main() to set a new Logger.setQuiet() flag; Logger.warn() now skips printing when it's set, mirroring Maven's own -q behavior of showing only errors.

Added MavenWrapperMainTest for the flag detection and LoggerTest for the suppression behavior. Verified by reverting the fix locally and confirming the new tests fail to compile against the old Logger/MavenWrapperMain API, then restoring it and confirming everything passes again. Full module test suite, checkstyle and spotless all green.


To make clear that you license your contribution under the Apache License Version 2.0, January 2004, check one of the following:

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004
  • I hereby declare that I have filed an Apache Individual Contributor License Agreement.

…stics

MavenWrapperMain prints its own messages (e.g. DefaultDownloader's
"insecure connection" warning) before Maven itself ever parses the
forwarded arguments, so passing -q/--quiet to mvnw had no effect on
them: Logger.warn() always wrote to stderr unconditionally.

Added MavenWrapperMain.isQuiet(args), a plain scan for -q/--quiet
matching Maven's own CLI, called at the very start of main() to set a
new Logger.setQuiet() flag; Logger.warn() now skips printing when it
is set, mirroring Maven's own -q behavior of showing only errors.

Added MavenWrapperMainTest for the flag detection and LoggerTest for
the suppression behavior.
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.

1 participant