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

Add support for custom ProjectDependencyAnalyzer implementations

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.2
    • analyze
    • None
    • Patch

    Description

      I've written a customized ProjectDependencyAnalyzer (includes dependencies from Spring XMLs) that I'd like to be able to use with the maven-dependency-plugin.

      The current plugin implementation only supports a single ProjectDependencyAnalyzer component on the classpath (otherwise plexus will fail) and has no way of specifying which analyzer to use at runtime.

      The appended patches add support for custom ProjectDependencyAnalyzer components to the plugin. The basic idea is to assign ProjectDependencyAnalyzer components a unique role-hint and let the plugin dynamically look-up the implementation to use by specifying the role-hint as configuration parameter.

      1. maven-dependency-analyzer_1.2.patch

      Patch against maven-dependency-analyzer 1.2-SNAPSHOT (trunk / r942613)

      To apply patch: patch -p1 <maven-dependency-analyzer_1.2.patch

      CHANGES:

      • DefaultProjectDependencyAnalyzer component now has an additonal role-hint 'default' so
        plexus won't complain when multiple ProjectDependencyAnalyzer components are one the classpath
      • changes the visibility of buildDependencyClasses() and findArtifactForClassName() from private to protected to allow subclassing
      • buildDependencyClasses() now takes the artifact map as additional parameter so subclasses can call findArtifactForClassName() with it

      2. maven-dependency-plugin_2.2.patch

      Patch against maven-dependency-plugin 2.2-SNAPSHOT (trunk / r942613)

      To apply patch: patch -p1 <maven-dependency-plugin_2.2.patch

      CHANGES:

      • AbstractDependencyMojo now has a new 'analyzer' parameter that is the role hint to use when
        looking up the ProjectDependencyAnalyzer from the container ( the default value is set to 'default' and thus references DefaultProjectDependencyAnalyzer)
      • AbstractDependencyMojo now implements Contextualizable and dynamically looks up the ProjectDependencyAnalyzer component to use from the plexus container
      • Integration test added that first buids and installs a custom dummy ProjectDependencyAnalyzer component
        and then runs dependency:analyze with this analyzer

      Attachments

        1. maven-dependency-analyzer_1.2.patch
          2 kB
          Brett Porter
        2. maven-dependency-analyzer_1.2.patch
          3 kB
          Tobias Gierke
        3. maven-dependency-plugin_2.2.patch
          4 kB
          Brett Porter
        4. maven-dependency-plugin_2.2.patch
          15 kB
          Tobias Gierke

        Activity

          People

            brianf Brian E Fox
            toby1984 Tobias Gierke
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: