Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Not A Problem
-
maven-dependency-tree-1.2
-
None
-
None
-
Windows XP 64 JDK 1.6
Description
I have a report and a mojo that seeks transversal dependencies. It shows a nullpointer in the DefaultDependencyTreeBuilder.
I can not figure it out what is wrong sice the implementation off DependencyTreeBuilder is assigned by Maven and I have no controll on the logger.
Here is the code snippet
//members /** * Used to look up Artifacts in the remote repository. * * @parameter expression= * "${component.org.apache.maven.artifact.factory.ArtifactFactory}" * @required * @readonly */ protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory; /** * Used to look up Artifacts in the remote repository. * * @parameter expression= * "${component.org.apache.maven.artifact.resolver.ArtifactResolver}" * @required * @readonly */ protected org.apache.maven.artifact.resolver.ArtifactResolver resolver; /** * Artifact collector, needed to resolve dependencies. * * @component role="org.apache.maven.artifact.resolver.ArtifactCollector" * @required * @readonly */ protected ArtifactCollector artifactCollector; /** * @component * role="org.apache.maven.artifact.metadata.ArtifactMetadataSource" * hint="maven" * @required * @readonly */ protected ArtifactMetadataSource artifactMetadataSource; /** * Dependency tree builder component. * * @component expression= * "org.apache.maven.shared.dependency.tree.DependencyTreeBuilder" * @required * @readonly */ private DependencyTreeBuilder dependencyTreeBuilder; //sample snippet to use in report and mojo ArtifactFilter artifactFilter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE); DependencyNode dn; getLog().info("Start"); try { dn = dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFactory, artifactMetadataSource, artifactFilter, artifactCollector); } catch (DependencyTreeBuilderException e) { e.printStackTrace(); getLog().error("oeps",e); } getLog().info("Done");