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

same pom.xml is read multiple times

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.3
    • 4.0.0-alpha-2, 4.0.0
    • None
    • None

    Description

      The same parent pom.xml is read multiple times during single ProjectBuilder#build invocation. This is a performance regression introduced in 3.2.3-SNAPSHOT. I do not know how much this affects real-world build performance.

      ~~~~~

      ProjectBuilder#build(File,ModelSource,...) first constructs project model then
      initializes MavenProject instance.

      When project model is constructed, all local and remote parent pom.xml files
      are read and stored in model cache during ModelBuilder#readParent. The cache uses GAV keys. Only parent models are stored in the cache. The model of the project being being is not cached.

      When MavenProject instance is initialized, ProjectBuilder#build is called recursively to create parent MavenProject instances.

      There are appears to be two problems

      • ModelCache used to create original project Model is not passed to the
        recursive ProjectBuilder#build invocation.
      • ProjectBuilder#build does not use ModelCache for the project being built.
        During recursive invocation, this means the cache is never used to load
        parent pom.xml models cached during outer ProjectBuilder#build invocation.

      The solution is to introduce additional short-lived model cached keyed by
      pom.xml file location (project GAV is not known when ProjectBuilder#build is
      called). Alternatively, introduce ProjectBuilder#buildParent that will use
      the model cache.

      Attachments

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              igorf Igor Fedorenko
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m