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

Long build time - enforcer running too many times

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0-alpha-6
    • 3.0-alpha-7
    • None
    • None

    Description

      A simple mvn clean validate has more than tripled in time on a multi module project I'm working on (when compared to 2.2.1).

      From what I've read on the list the 3.0-alpha-6 is supposed to be quicker than 2.x so I'm quite surprised by this.

      The project is a multi-module project, with a corporate pom at the top of the tree.

      From my interpretation of the build log the enforcer plugin is now validating more than just the current module's pom for each module build.

      e.g.

      Corp Pom (defines validation rules)

      ProjA (parent is corp pom)
      + ModA
      + Mod B
      + Mod C

      That is when mvn validate is run on proj A when the reactor moves to a mod A it runs the enforcer rules on ProjA ModA, ModB and ModC, and again when it builds Mod B it runs the enforecer rules again on all these modules etc...

      I would only expect the enforcer to run against the project/module that it is currently building (like maven 2.2.1).

      Note: the test project attached does not show the massive slowdown but does show the enforcer running too many times (mvn clean validate | grep enforce). The massive slowdown is due to the company enfrcer rules that perform a svn status for each invocation of the enforcer rules - but any enforcer rule which takes some time to complete will show the same results when run needlessly.

      mvn 2.2.1 output ("mvn validate")
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO] ------------------------------------------------------------------------
      [INFO] Project : Parent ...................................... SUCCESS [4.704s]
      [INFO] Project : Mod A ....................................... SUCCESS [2.225s]
      [INFO] Project : Mod B ....................................... SUCCESS [2.225s]
      [INFO] Project : Mod C ....................................... SUCCESS [2.225s]
      [INFO] Project : Mod D ....................................... SUCCESS [2.215s]
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 14 seconds

      mvn 3.0-alpha-6 output ("mvn validate")
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] Project : Parent .................................. SUCCESS [7.361s]
      [INFO] Project : Mod A ................................... SUCCESS [6.079s]
      [INFO] Project : Mod B ................................... SUCCESS [6.068s]
      [INFO] Project : Mod C ................................... SUCCESS [6.069s]
      [INFO] Project : Mod D ................................... SUCCESS [6.029s]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 31.866s

      The reason by looking at the logs seems the enforcer rule is run for each module in the build for every module build.
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Project : Mod C 0.0.1-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ modc —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ parent —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ moda —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ modb —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ modc —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-enforcer-plugin:1.0-beta-1:enforce (enforce-rules) @ modd —
      [INFO] complex enforcer rule starting
      [INFO] complex enforcer rule finished
      [INFO]
      [INFO] — maven-scm-plugin:1.2:validate (validate) @ modc —
      [INFO]

      Whilst in Maven 2.2.1 the rules are run twice for each module (due to the build forking by the scm validate) they are run N times where N == number of modules in reactor for each module in the reactor.

      to reproduce.
      extract attachment
      mvn install long_running_enforcer
      mvn install corp_pom

      mvn validate project (repeat with mavan 2.2.1 and maven 3.0-alpha-6)

      Attachments

        1. m3.0-a6.zip
          6 kB
          James Nord

        Activity

          People

            bentmann Benjamin Bentmann
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: