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.
Patch against maven-dependency-analyzer 1.2-SNAPSHOT (trunk / r942613)
To apply patch: patch -p1 <maven-dependency-analyzer_1.2.patch
- 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
Patch against maven-dependency-plugin 2.2-SNAPSHOT (trunk / r942613)
To apply patch: patch -p1 <maven-dependency-plugin_2.2.patch
- 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