Long build time - enforcer running too many times
-------------------------------------------------
Key: MNG-4536
URL: http://jira.codehaus.org/browse/MNG-4536
Project: Maven 2 & 3
Issue Type: Bug
Affects Versions: 3.0-alpha-6
Environment: Apache Maven 3.0-alpha-6 (r896384; 2010-01-06
11:00:46+0000)
Java version: 1.6.0_16
Java home: C:\Java\jdk1.6.0_16\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
Reporter: James Nord
Attachments: m3.0-a6.zip
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)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira