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

dependency:tree fails with NPE if executed twice

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Auto Closed
    • Affects Version/s: 2.5, 2.5.1
    • Fix Version/s: None
    • Component/s: tree
    • Labels:
      None
    • Environment:

      Description

      Plugin fails to generate the dependency tree when executed twice, the second one for Cobertura life cycle:

      $ mvn --batch-mode --update-snapshots --errors clean install dependency:analyze-only cobertura:cobertura
      (...)
      [INFO] [dependency:tree

      Unknown macro: {execution}

      ]
      [INFO] Wrote dependency tree to: /target/classes/META-INF/bom/dependency-tree.txt
      (...)
      [INFO] Preparing cobertura:cobertura
      (...)
      [INFO] [dependency:tree

      Unknown macro: {execution}

      ]
      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] null
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      java.lang.NullPointerException
      at org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder.buildDependencyTree(DefaultDependencyTreeBuilder.java:139)
      at org.apache.maven.shared.dependency.graph.internal.Maven2DependencyGraphBuilder.buildDependencyGraph(Maven2DependencyGraphBuilder.java:55)
      at org.apache.maven.shared.dependency.graph.internal.DefaultDependencyGraphBuilder.buildDependencyGraph(DefaultDependencyGraphBuilder.java:63)
      at org.apache.maven.plugin.dependency.TreeMojo.execute(TreeMojo.java:202)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:643)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      [INFO] ----
      [INFO] Total time: 11 seconds
      [INFO] Finished at: Mon Sep 10 11:02:34 BRT 2012
      [INFO] Final Memory: 69M/379M
      [INFO] ----

      The plugin is defined in pom.xml as:

      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-dependency-plugin</artifactId>
      				<version>2.5</version>
      				<executions>
      					<execution>
      						<id>gerar-dependency-tree</id>
      						<phase>initialize</phase>
      						<goals>
      							<goal>tree</goal>
      						</goals>
      						<configuration>
      							<appendOutput>false</appendOutput>
      							<outputFile>${project.build.outputDirectory}/META-INF/bom/dependency-tree.txt</outputFile>
      							<outputType>text</outputType>
      						</configuration>
      					</execution>
      				</executions>
      				<inherited>true</inherited>
      			</plugin>
      

      When I use Maven 3.0.4 it works correctly, but our CI server is stucked in Maven 2.2.1.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ttres Taciano Tres
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: