Hi,

On 06.04.23 17:15, Tommy Svensson wrote:
Hello maven users,

I have an observation that does not make sense to me:

I have a multi module build of about 5 modules.

I do an "mvn clean install" and it takes 43 seconds.

I then do an "mvn install" and it takes 43 seconds !

The second time everything was already built, so no compilation at all should have been done. So why does it 
still take 43 seconds ? I can do "mvn install" over and over again and it takes 43 seconds. No diff 
between "mvn clean install" and "mvn install" when everything is already built.

Is the compile so extremely fast that it doesn't even take a second while 
everything else maven does takes 43 seconds ?

1. What kind of project are you working with?

2. Are you running on plain command line? (not from within your IDE!!!)

   If not do all the tests from plain command line (Terminal in MacOS):

3. Is this a single module project or a multi module project?

4. Run "mvn clean" separately and afterwards do


   mvn verify

   another time do "mvn verify -DskipTests"

   compare those times?


Also very important: Do you use the most recent versions of plugins?
Check that against https://maven.apache.org/plugins

Check the log output for something like "Nothing to compile - all
classes are up to date"  (at least from the maven-compiler-plugin) if
not you are not using the most recent versions of those plugin...

4. If this is a multi module build you can try to build in parallel:

   mvn verify -T 3

5. If you identified the tests as the culprit check if those tests are
true unit tests... if so try to parallelize them.. depending on which
unit testing framework you are using (for example JUnit Jupiter can do
that)...


6. tip: "mvn install" is more or less never needed. "install" will
deploy the built artifacts into your local cache "$HOME/.m2/repository"
It's only necessary if you want to consume your built artifacts from an
other maven project... otherwise it's not necessary.


Kind regards
Karl Heinz Marbaise

I have a Mac M1 with 10 cores and 64 GB of memory (and no buss, processor and 
memory in same chip). The maven speed difference between my machine and the 
work machine (Intel I5 2 cores and 8GB memory) doesn't really differ that much. 
That is with maven. For other things there is a big difference.

Is there any good explanation for this ? I have used maven for a very long time 
and this is the first time I have noticed this. New faster machines have always 
improved build speed before.

I'm running Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) That 
is what the latest version of IDEA gives me.


BR,
Tommy Svensson






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to