[ http://jira.codehaus.org/browse/MSHARED-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159492#action_159492 ]
Gin-Ting Chen commented on MSHARED-80: -------------------------------------- If you use what Mark Hobson wrote {code} * @component role="org.apache.maven.shared.dependency.tree.DependencyTreeBuilder" {code} Then it will work. I don't know why TreeMojo works without the role. > NullPointer in DefaultDependencyTreeBuilder.java:93, no logger > --------------------------------------------------------------- > > Key: MSHARED-80 > URL: http://jira.codehaus.org/browse/MSHARED-80 > Project: Maven Shared Components > Issue Type: Bug > Components: maven-dependency-tree > Affects Versions: maven-dependency-tree 1.2 > Environment: Windows XP 64 JDK 1.6 > Reporter: MTStorm > Assignee: Mark Hobson > Priority: Critical > Attachments: simple-project.zip > > > 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"); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira