Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5312

MavenProject.getParent intolerably slow when import scope used heavily

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.4
    • Fix Version/s: 3.1.0-alpha-1
    • Component/s: Embedding
    • Labels:
      None
    • Environment:
      JDK 7, Ubuntu
    • Flags:
      Patch

      Description

      For projects which make heavy use of <scope>import</scope> including in parent POMs, calling MavenProject.getParent (thus DefaultProjectBuilder.build(Artifact, ...)) can be intolerably slow - taking many minutes - even when loading the project (or its parent) via DefaultProjectBuilder.build(List<File>, ...) takes less than a second.

      The discrepancy seems to be due to the fact that ReactorModelCache is crucial for the performance of DefaultModelBuilder.importDependencyManagement, yet only one DefaultProjectBuilder.build overload defines a ModelCache. For resolution of parents from a single POM, no model cache is likely to be needed under normal circumstances, but if you are missing a cache when import scope dependencies are processed for <dependencyManagement>, the builder takes exponential time to find these imports.

      I do not have a minimal test case for this yet as the known test case involves a large and complex proprietary source base. Patch (baseline is 3.0.4) successfully tested against these sources and shown to reduce getParent times by orders of magnitude.

      https://issues.jenkins-ci.org/browse/JENKINS-11362 is the downstream issue describing symptoms.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jvanzyl Jason van Zyl
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: