Skip to content
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

[MDEP-957] By default, don't report slf4j-simple as unused #433

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Oct 9, 2024

slf4j-simple is a super common "unused" dependency because when slfj-api or slf4j-impl is included and slf4j-simple isn't, the application works just fine but prints an annoying log message to the console telling developers to add it.

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.

or

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

so devs deliberately add slf4j-simple to their dependencies just to shut up these warnings.

see https://www.slf4j.org/manual.html

*
* @since 2.10
*/
@Parameter
private String[] ignoredUnusedDeclaredDependencies = new String[0];
private String[] ignoredUnusedDeclaredDependencies = {"org.slf4j:slf4j-simple::"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. why not use a default option of parameter?
  2. when user defined another ignores list it will be overridden ... maybe we need add it latter to be always ignored ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little later in the file I see this comment

    // defaultValue value on @Parameter - not work with Maven 3.2.5
    // When is set defaultValue always win, and there is no possibility to override by plugin configuration.

Comment on lines 232 to 233
* By default, org.slf4j:slf4j-simple is ignored. Setting this property to an empty list
* will allow it to be detected.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also setting to something else will detect slf4j-simple again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this comment out. The doc generator will pick up the default value here and document it.

Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection. @slawekjaranowski?

@elharo elharo merged commit 6da7a1d into master Oct 18, 2024
51 checks passed
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.

3 participants