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

Multi-module dependencies incorrectly marked as unused

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-alpha-4, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.5.1, 2.6
    • 2.7
    • analyze
    • None
    • Patch

    Description

      MDEP-72 made DefaultProjectDependencyAnalyzer.buildArtifactClassMap() only consider jar files, i.e.:

      if ( file != null && file.getName().endsWith( ".jar" ) )

      This causes it to ignore all classes defined in a submodule of a multi-module project. See the attached example. It has two submodules:

      • a, which defines an interface Foo
      • b, which defines a class FooImpl that implements Foo

      Running "mvn dependency:analyze" results in:

      [WARNING] Unused declared dependencies found:
      [WARNING]    com.example:a:jar:0.0.1-SNAPSHOT:compile
      

      The following change fixes the issue:

      if ( file != null && (file.getName().endsWith( ".jar" ) || file.isDirectory()) )

      Attachments

        1. mda-test.tar
          42 kB
          Tim Williamson
        2. DEP-399.patch
          0.7 kB
          hgschmie

        Issue Links

          Activity

            People

              brianf Brian E Fox
              timnasn Tim Williamson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: