-
Notifications
You must be signed in to change notification settings - Fork 182
Improve usage of silent parameter in Copy and Unpack goals #1517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
slawekjaranowski
commented
Sep 13, 2025
- parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo
- use it during logging of coping or unpacking
* | ||
* @param sourceArtifact the artifact (file) to copy | ||
* @param destination file name of destination file | ||
* @param silent if true, use debug log level, otherwise info for logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels wrong. Logging should be controlled by log levels, not Maven parameters
* @since 3.2.0 | ||
*/ | ||
public void copyFile(File source, File destination) throws IOException { | ||
logger.debug("Copying file '{}' to {}", source, destination); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really can't see why this should be anything other than debug by default. This is not an actionable message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eg. When using copy
mojo from cli I need an information what was copied for auditing
logger.debug("Copying file '{}' to {}", source, destination); | ||
public void copyFile(File source, File destination, boolean silent) throws IOException { | ||
if (!silent) { | ||
logger.info("Copying file '{}' to {}", source, destination); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and now if the user turns on debugging but this is silent they don't see this
* Use {@code -q} command line option if you want to suppress all output. | ||
* @since 2.0 | ||
*/ | ||
@Parameter(property = "silent", defaultValue = "false") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be deprecated as it was where it was moved from
@elharo @michael-o I know that you worked on silent parameter, and proposed to deprecate it. It is directly used only in a few places so I propose move it to place where is used. I alos remove overvriting logger in Mojo at all - it should be done by I would like to have possibility to log what is copied, unpacked - form some of auditing perspective. |
related: #447 |
I do not want a large set of switches for every imaginable combination of logging this and that but not some other thing. The default is not to log things users don;t need to know and aren't going to act on the vast majority of the time. If you need more than that, turn on the debug logs. Yes, it's verbose but so is logging every file that's copied. |
so I moved it where is used ... we have small number of switches
In this case I think it is useful information what happens
Similar we can say, if you don't want logs use -q options |
d35f602
to
cd9084a
Compare
- parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo - use it during logging of coping or unpacking
3fd0746
to
cdc8f20
Compare
@elharo changing log to system-out make be a problematic in Maven4 I don't understood why we can not use silent option where is needed .. eg is used in how do you want to replace such code: Lines 96 to 104 in 9377649
Do we want to move every message into debug level? |
Yes, exactly. Silent is debug, We don't need anything else. Our logs are vastly too noisy with severe consequences for usability. |