Maven Shared Components
  1. Maven Shared Components
  2. MSHARED-77

DependencyTreeResolutionListener throws NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker 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"
    • Number of attachments :
      1

      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
          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
          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.
          Christian Schulte made changes -
          Field Original Value New Value
          Attachment MSHARED-77.patch [ 38044 ]
          Herve Boutemy made changes -
          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)
          Having

          {code:xml}<dependency>
            <groupId>groupId</groupId>
            <artifactId>artifactId</artifactId>
            <version>[1.5,)</version>
            <scope>compile</scope>
          </dependency>{code}

          inside dependencyManagement mvn site fails with

          {noformat}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){noformat}
          Herve Boutemy made changes -
          Link This issue is duplicated by MSHARED-95 [ MSHARED-95 ]
          Herve Boutemy made changes -
          Link This issue is related to MSHARED-101 [ MSHARED-101 ]
          Olivier Lamy made changes -
          Link This issue duplicates MSHARED-101 [ MSHARED-101 ]
          Olivier Lamy made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Olivier Lamy [ olamy ]
          Resolution Duplicate [ 3 ]

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              Christian Schulte
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: