1. Maven
  2. MNG-2861

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


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


      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.2 - redirecting to newgroupId:project:1.2

      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] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] null
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(
      at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(
      at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(
      at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
      at org.apache.maven.DefaultMaven.doExecute(
      at org.apache.maven.DefaultMaven.execute(
      at org.apache.maven.cli.MavenCli.main(
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(
      at java.lang.reflect.Method.invoke(
      at org.codehaus.classworlds.Launcher.launchEnhanced(
      at org.codehaus.classworlds.Launcher.launch(
      at org.codehaus.classworlds.Launcher.mainWithExitCode(
      at org.codehaus.classworlds.Launcher.main(

      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.

        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


          No work has yet been logged on this issue.


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


              • Created: