Skip to content

Conversation

slawekjaranowski
Copy link
Member

  • parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo
  • use it during logging of coping or unpacking

@slawekjaranowski slawekjaranowski added the enhancement New feature or request label Sep 13, 2025
@slawekjaranowski slawekjaranowski self-assigned this Sep 13, 2025
*
* @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
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Member Author

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);
Copy link
Contributor

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")
Copy link
Contributor

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

@slawekjaranowski
Copy link
Member Author

@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 -q option.

I would like to have possibility to log what is copied, unpacked - form some of auditing perspective.
Using -X debug options is to verbose.

@elharo
Copy link
Contributor

elharo commented Sep 13, 2025

related: #447

@elharo
Copy link
Contributor

elharo commented Sep 13, 2025

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.

@slawekjaranowski
Copy link
Member Author

I do not want a large set of switches for every imaginable combination of logging this and that but not some other thing.

so I moved it where is used ... we have small number of switches

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.

In this case I think it is useful information what happens

If you need more than that, turn on the debug logs. Yes, it's verbose but so is logging every file that's copied.

Similar we can say, if you don't want logs use -q options

- parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo

- use it during logging of coping or unpacking
@slawekjaranowski
Copy link
Member Author

@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 GoOfflineMojo

how do you want to replace such code:

if (!isSilent()) {
for (Artifact artifact : plugins) {
this.getLog().info("Resolved plugin: " + DependencyUtil.getFormattedFileName(artifact, false));
}
for (Artifact artifact : dependencies) {
this.getLog().info("Resolved dependency: " + DependencyUtil.getFormattedFileName(artifact, false));
}
}

Do we want to move every message into debug level?

@elharo
Copy link
Contributor

elharo commented Sep 15, 2025

Yes, exactly. Silent is debug, We don't need anything else. Our logs are vastly too noisy with severe consequences for usability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants