Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-787

Allow ignoring non-test-scoped dependencies

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 3.2.0, 3.3.0
    • 3.3.0
    • None
    • None

    Description

      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 imported 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…

      Attachments

        Issue Links

          Activity

            People

              sjaranowski Slawomir Jaranowski
              mirabilos Thorsten Glaser
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: