Uploaded image for project: 'Maven Enforcer Plugin'
  1. Maven Enforcer Plugin
  2. MENFORCER-420

Reuse getDependenciesToCheck results across rules

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.1.0
    • Standard Rules
    • None

    Description

      We have a build with a significant number of dependencies, and also a large number of <bannedDependencies/> rules. Together, they lead to a build where Enforcer takes tens of minutes.

      Looking into bottlenecks, we found that AbstractBanDependencies#getDependenciesToCheck was taking a significant proportion of the build time (tens of percent). This method is called once per rule, so it's recalculating the dependencies for every rule across every execution.

      Introducing a cache, to reuse the dependencies one they'd been calculated for a module, dropped the time spent in banned dependency enforcement by about 75%, which was reflected as a 60% improvement in the time of that build.

      Our local implementation used the org.codehaus.plexus.context.Context to store the dependencies keyed by the concatenation of MavenProject#getId and searchTransitive; there may be a more appropriate scope to avoid edge cases with complex configurations.

      Attachments

        Issue Links

          Activity

            People

              sjaranowski Slawomir Jaranowski
              joe@kafsemo.org Joseph Walton
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: