Maven
  1. Maven
  2. MNG-2861

NullPointerException in DefaultArtifactCollector for relocated resolvedArtifacts with different version ranges and available versions.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.0.9
    • Labels:
      None

      Description

      In a remoteRepository that I am populating I have a project. Previously I was deploying artifacts with an old groupId and then decided to switch to having a new more descriptive groupId. For the old groupId I have deployed versions 1.0 and 1.1. For the new groupId I have deployed 1.2 and 2.0. I deployed a relocation POM to the old groupId for the 1.2 version. I also updated the metadata.xml files to include 1.2 as an available version. This way projects using version ranges [1,2) will be able to pick up the newest version. So in the repository I now have:

      oldgroupId:project:1.0
      oldgroupId:project:1.1
      oldgroupId:project:1.2 - redirecting to newgroupId:project:1.2
      newgroupId:project:1.2
      newgroupId:project:2.0

      The oldgroupId's metadata lists the available versions as [1.0,1.1,1.2]. The newgroupId's metadata lists the available versions has [1,2].

      I have 3 additional projects A, B, C. A depends on B and C. B depends on oldgroupId:project:[1,2). Project B has also finished development and been released so we are avoiding rereleasing it for the groupId change. C depends on newgroupId:project:[2,3). When I try to build project A, Maven dies and gives me the following stack trace.

      [INFO] ------------------------------------------------------------------------
      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] null
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      java.lang.NullPointerException
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:168)
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:305)
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:305)
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:70)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:284)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:272)
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:243)
      at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1142)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:374)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
      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:585)
      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)

      Since the key for common dependency is the same it tries to resolve the dependency by restricting the version ranges of the current and previous resolved artifacts. It restricts the previous version to the range of to be [2,3). However since the only available versions are [1.0,1.1,1.2] it cannot find and match and on line 168 it calls toString() on the returned match which is null.

      I realize that the repository setup might not be completely correct, however this is still an issue since Maven crashes without giving any appropriate message or warning to the cause.

      1. MNG-2861_broken.zip
        33 kB
        Micah Whitacre
      2. MNG-2861.tar.gz
        11 kB
        Brett Porter
      3. MNG-2861-maven-project.patch
        2 kB
        Matthew Beermann

        Issue Links

          Activity

          Micah Whitacre created issue -
          Carlos Sanchez made changes -
          Field Original Value New Value
          Link This issue is related to MNG-2923 [ MNG-2923 ]
          Jason van Zyl made changes -
          Component/s Artifacts and Repositories [ 11338 ]
          Component/s Artifacts [ 12035 ]
          Jason van Zyl made changes -
          Fix Version/s Reviewed [ 13555 ]
          Matthew Beermann made changes -
          Attachment MNG-2861-maven-project.patch [ 28614 ]
          Brett Porter made changes -
          Assignee Brett Porter [ brettporter ]
          Brett Porter made changes -
          Fix Version/s 2.0.x [ 13141 ]
          Attachment MNG-2861.tar.gz [ 29044 ]
          Fix Version/s Reviewed Pending Version Assignment [ 13555 ]
          Assignee Brett Porter [ brettporter ]
          Micah Whitacre made changes -
          Attachment MNG-2861_broken.zip [ 29067 ]
          Brian Fox made changes -
          Link This issue is related to MNG-2123 [ MNG-2123 ]
          Brian Fox made changes -
          Fix Version/s 2.0.x [ 13141 ]
          Fix Version/s 2.0.9 [ 13801 ]
          Brian Fox made changes -
          Assignee Brian Fox [ brianfox ]
          Brian Fox made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Brian Fox made changes -
          Link This issue is related to MNG-3454 [ MNG-3454 ]
          Brian Fox made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Workflow jira [ 12713391 ] Default workflow, editable Closed status [ 12752672 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Workflow jira [ 12949862 ] Default workflow, editable Closed status [ 12986070 ]

            People

            • Assignee:
              Brian Fox
              Reporter:
              Micah Whitacre
            • Votes:
              11 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development