Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-80

NullPointer in DefaultDependencyTreeBuilder.java:93, no logger

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Not A Problem
    • maven-dependency-tree-1.2
    • None
    • maven-dependency-tree
    • 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");

      Attachments

        1. simple-project.zip
          4 kB
          MTStorm

        Activity

          People

            markh Mark Hobson
            markh Mark Hobson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: