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

DependencyTreeResolutionListener throws NullPointerException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: maven-dependency-tree-1.2
    • Fix Version/s: None
    • Component/s: maven-dependency-tree
    • Labels:
      None
    • Environment:
      Maven version: 2.0.10-RC1
      Java version: 1.4.2_18
      OS name: "linux" version: "2.6.27.4-core2" arch: "i386" Family: "unix"

      Description

      Having

      <dependency>
        <groupId>groupId</groupId>
        <artifactId>artifactId</artifactId>
        <version>[1.5,)</version>
        <scope>compile</scope>
      </dependency>

      inside dependencyManagement mvn site fails with

      java.lang.NullPointerException: version was null for groupId:artifactId
              at org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:362)
              at org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifact.java:225)
              at org.apache.maven.shared.dependency.tree.DependencyTreeResolutionListener.manageArtifactScope(DependencyTreeResolutionListener.java:362)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.fireEvent(DefaultArtifactCollector.java:563)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.fireEvent(DefaultArtifactCollector.java:516)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.manageArtifact(DefaultArtifactCollector.java:454)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:311)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:424)
              at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:74)
              at org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder.buildDependencyTree(DefaultDependencyTreeBuilder.java:97)
              at org.apache.maven.report.projectinfo.DependenciesReport.resolveProject(DependenciesReport.java:267)
              at org.apache.maven.report.projectinfo.DependenciesReport.executeReport(DependenciesReport.java:228)
              at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:90)
              at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:139)
              at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:269)
              at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:101)
              at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:133)
              at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:100)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              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)

        Issue Links

          Activity

          Hide
          schulte77 Christian Schulte added a comment -

          Patch to use artifact.getDependencyConflictId() instead of artifact.getId() as the key to the map of premanaged scopes. This solves the NullPointerException for me and should not change anything for projects not using version ranges in the dependency management.

          Show
          schulte77 Christian Schulte added a comment - Patch to use artifact.getDependencyConflictId() instead of artifact.getId() as the key to the map of premanaged scopes. This solves the NullPointerException for me and should not change anything for projects not using version ranges in the dependency management.

            People

            • Assignee:
              olamy Olivier Lamy (*$^¨%`£)
              Reporter:
              schulte77 Christian Schulte
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development