views:

18

answers:

1

sorry for being dumb here, but I failed to see why these tools can speed up the build.

for example (if I understand it correctly), maven-cli requires you to do a build once: clean, compile, install, then it speeds up your build by caching the clean and compile phrase, so you can execute the install phrase only over and over.

at my first glance, that seems to speed things by not going thru the full loop over and over. however, in reality, if I'm making code changes, shouldn't I alway re-compile my code before running the install? in that case, how does the speed get faster? the clean phrase might be faster, but for my 100ish modules project, the clean only takes like 5 secs anyways.

so am I being misunderstood about these tools completely? can somehow explain to me how these tools can improve the speed at all? thanks.

mvnsh: http://shell.sonatype.org/faq.html

mvn-cli-plugin: http://wiki.github.com/mrdon/maven-cli-plugin/

A: 

In short, the idea of these tools is not to skip phases but to avoid the cost of the initialization of the JVM, of the Maven engine, of plugins, etc at each build by caching them in a ready to (re)use environment.

This is pretty well summarized (maybe better than in the FAQ) in this Intro to Maven Shell blog post:

Sonatype has released a nifty utility called Maven Shell that allows developers to execute maven goals/phases in a pre-loaded shell environment, significantly reducing the build time. It does this by loading up a JVM, Maven, and any loaded plugin once and leverages that existing load for each subsequent build. I downloaded the .10 binary and played around with it with a very simple multi-module project. Here is a quick primer on some of the things you can expect from Maven Shell.

The same blog post provides some metrics illustrating the improvements on a simple build.

I personally just love Maven Shell, it's really a great tool and warmly recommended it to any Maven user.

Pascal Thivent