Skip to content

[MDEP-787] Allow ignoring non-test-scoped dependencies #1291

@jira-importer

Description

@jira-importer

Thorsten Glaser opened MDEP-787 and commented

This was found due to testing whether 3.3.0-SNAPSHOT fixes the regressions of 3.2.0 against 3.1.2 (it doesn’t, yet).

After finding https://maven.apache.org/guides/development/guide-testing-development-plugins.html I was able to test the snapshot on the https://github.com/tarent/extract-tool/tree/mdep753-snapshot branch as well.

This problem shows up:

$ mvn dependency:analyze-only@analyse-dependency-usage
[…]
[WARNING] Non-test scoped test only dependencies found:
[WARNING] com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.13.1:compile

This is “correct”: com.fasterxml.jackson.dataformat.yaml.YAMLFactory is {}import{}ed in the tests but only used via reflection in prod because it’s an optional (but not marked as optional so it’s included by default, but users can <exclude> it and that’s supported and documented) dependency. This means it’s a false positive that cannot be expected to be handled by the test correctly and must be overridden in the POM.

However, adding it as <ignoredUnusedDeclaredDependency> does not work ☹ it’s probably the wrong overriding element, but https://maven.apache.org/plugins/maven-dependency-plugin/analyze-only-mojo.html does not have anything on how to override this particular warning.

This is a must-have for, I hope, obvious reasons…


Affects: 3.2.0, 3.3.0

Issue Links:

  • MDEP-753 Non-test dependency reported as Non-test scoped test only dependency

Remote Links:

1 votes, 4 watchers

Metadata

Metadata

Labels

enhancementNew feature or requestpriority:blockerBlocks development and/or testing work, production could not run

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions