Skip to content
Advertisement

What sort of configuration issues or problems might make Maven Assembly plugin go slowly?

Our multi-module Maven project used to take 4-6 minutes to build. Over the past few months, it has increased to 20+ minutes per build. One symptom is that sometimes the build appears to pause until I hit <enter>. However, the Maven build still runs fine (6 minutes, no pauses) on our build server.

The build command is mvn clean package -D<profile>

Some of our plugins include:

  • PMD
  • FindBugs
  • Assembly
  • Thrift Compiler
  • jspc-maven-plugin
  • maven-replacer-plugin

Also, we have an internal Nexus repository.

Update: Build Logs

Local Build:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Project Parent ............................. SUCCESS [17.703s]
[INFO] Dependencies ............................... SUCCESS [0.109s]
[INFO] Thrift Service ............................. SUCCESS [1:51.141s]
[INFO] Thrift API Client Sample ................... SUCCESS [14.219s]
[INFO] Application ................................ SUCCESS [14:07.984s]
[INFO] Webapps Parent ............................. SUCCESS [1.250s]
[INFO] Webapp A ................................... SUCCESS [27.547s]
[INFO] Webapp B.................................... SUCCESS [20.672s]
[INFO] Webapp C ................................... SUCCESS [1:14.656s]
[INFO] Assembly ................................... SUCCESS [5:47.219s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24:23.234s
[INFO] Finished at: Fri Jan 27 10:47:38 EST 2012
[INFO] Final Memory: 25M/66M
[INFO] ------------------------------------------------------------------------

Build Server (Team City):

[02:16:31]: [INFO] ------------------------------------------------------------------------
[02:16:31]: [INFO] Reactor Summary:
[02:16:31]: [INFO]
[02:16:31]: [INFO] Project Parent ............................. SUCCESS [3.421s]
[02:16:31]: [INFO] Dependencies ............................... SUCCESS [3.157s]
[02:16:31]: [INFO] Thrift Service ............................. SUCCESS [41.314s]
[02:16:31]: [INFO] Thrift API Client Sample ................... SUCCESS [1.220s]
[02:16:31]: [INFO] Application ................................ SUCCESS [4:09.617s]
[02:16:31]: [INFO] Webapps Parent ............................. SUCCESS [0.323s]
[02:16:31]: [INFO] Webapp A ................................... SUCCESS [12.811s]
[02:16:31]: [INFO] Webapp B ................................... SUCCESS [16.496s]
[02:16:31]: [INFO] Webapp C ................................... SUCCESS [19.011s]
[02:16:31]: [INFO] Assembly ................................... SUCCESS [1:45.872s]
[02:16:31]: [INFO] ------------------------------------------------------------------------
[02:16:31]: [INFO] BUILD SUCCESS
[02:16:31]: [INFO] ------------------------------------------------------------------------
[02:16:31]: [INFO] Total time: 7:33.655s
[02:16:31]: [INFO] Finished at: Wed Jan 25 02:16:31 EST 2012
[02:16:31]: [INFO] Final Memory: 42M/317M
[02:16:31]: [INFO] ------------------------------------------------------------------------

Update 2

Here is an empirical analysis of where my build is spending most of its time, using timestamp analysis provided by this bash script: https://gist.github.com/993139

Build Times by Task

It seems to me that I could disable FindBugs, PMD and Unit Tests for some builds. But I need the final build output – the Assembly. So let me focus my question – what can make Assembly Plugin run slowly?

Update 3

As expected, FindBugs, PMD and unit tests cut the build by over 50%

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Project Parent .................................... SUCCESS [13.969s]
[INFO] Dependencies ...................................... SUCCESS [0.094s]
[INFO] Thrift Service .................................... SUCCESS [47.125s]
[INFO] Thrift API Client Sample .......................... SUCCESS [11.922s]
[INFO] Application ....................................... SUCCESS [3:10.922s]
[INFO] Webapps parent .................................... SUCCESS [0.468s]
[INFO] Webapp A .......................................... SUCCESS [18.157s]
[INFO] Webapp B .......................................... SUCCESS [18.437s]
[INFO] Webapp C .......................................... SUCCESS [1:00.672s]
[INFO] Assembly .......................................... SUCCESS [3:55.969s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9:58.609s
[INFO] Finished at: Mon Feb 06 10:21:01 EST 2012
[INFO] Final Memory: 24M/59M
[INFO] ----------------------------------------------------------------------

I don’t think that Assembly should take 4 minutes. During the assembly phase, I’m seeing a lot of the following:

[INFO] --- maven-assembly-plugin:2.2:single (assembly-full) @ assembly ---
[INFO] Reading assembly descriptor: C:projectsmy-projectassembly/src/main/assembly/assembly-full.xml
[INFO] project-2.9.3-SNAPSHOT/config/ already added, skipping
[INFO] project-2.9.3-SNAPSHOT/config/ already added, skipping
[INFO] project-2.9.3-SNAPSHOT/ already added, skipping
[INFO] project-2.9.3-SNAPSHOT/var/ already added, skipping

Repeated with each assembly artifact. Could this somehow be the source of the slowness?

Advertisement

Answer

First recommendation is to execute the build locally and watch the console. This should help you to easily identify the plugins that take longest.

From my recollection, PMD and FindBugs can take considerable amount of time to run. Same goes for javadoc on larger projects. The other plugins you mentioned I cannot comment on.

Of course, Nexus could be an issue if that runs on a slow system, maybe using slow storage.

Ah, just re-read your post: So it happens on local machines mainly. What is the local machine doing? Does it run into low memory situation? Where the pauses occur could also give an indication.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement