Maven slow
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 ? 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
Re: Maven slow
Well maven still has to go through all the lifecycle, which involves generating resources, compiling, packaging, running tests, checking snapshots, etc. So depending on your plugin, repository configuration you could get faster/slower subsequent builds. Unlike gradle, maven doesn't cache steps so the slowness is mostly due to having to go through the lifecycle. As far as I remember, the mailing list mentioned the takari lifecycle which changes a bit how maven works. You might want to experiment with it. http://takari.io/book/40-lifecycle.html On Thu, Apr 6, 2023, 18: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 ? > > 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 > > > >
Re: Maven slow
Hi Disclaimer: I'm a engineer @ Gradle You can also try the Gradle Enterprise Maven extension ( https://docs.gradle.com/enterprise/maven-extension/) Or the new Maven Cache extension https://maven.apache.org/extensions/maven-build-cache-extension/ to benefit from build caching for some goal executions of your project. I won't dive here into a comparison between the two. Just wanted to share this for awareness. François Le jeu. 6 avr. 2023, 17:23, Mantas Gridinas a écrit : > Well maven still has to go through all the lifecycle, which involves > generating resources, compiling, packaging, running tests, checking > snapshots, etc. So depending on your plugin, repository configuration you > could get faster/slower subsequent builds. Unlike gradle, maven doesn't > cache steps so the slowness is mostly due to having to go through the > lifecycle. > > As far as I remember, the mailing list mentioned the takari lifecycle which > changes a bit how maven works. You might want to experiment with it. > http://takari.io/book/40-lifecycle.html > > > On Thu, Apr 6, 2023, 18: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 ? > > > > 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 > > > > > > > > >
Re: Maven slow
Hi Tommy, Maybe look at setting up https://github.com/khmarbaise/maven-buildtime-profiler to see if you can see where the time is being spent or not being spent. On Thu, 6 Apr 2023 at 16:29, François Guillot wrote: > Hi > > Disclaimer: I'm a engineer @ Gradle > > You can also try the Gradle Enterprise Maven extension ( > https://docs.gradle.com/enterprise/maven-extension/) > Or the new Maven Cache extension > https://maven.apache.org/extensions/maven-build-cache-extension/ > to benefit from build caching for some goal executions of your project. > > I won't dive here into a comparison between the two. Just wanted to share > this for awareness. > > François > > Le jeu. 6 avr. 2023, 17:23, Mantas Gridinas a écrit > : > > > Well maven still has to go through all the lifecycle, which involves > > generating resources, compiling, packaging, running tests, checking > > snapshots, etc. So depending on your plugin, repository configuration you > > could get faster/slower subsequent builds. Unlike gradle, maven doesn't > > cache steps so the slowness is mostly due to having to go through the > > lifecycle. > > > > As far as I remember, the mailing list mentioned the takari lifecycle > which > > changes a bit how maven works. You might want to experiment with it. > > http://takari.io/book/40-lifecycle.html > > > > > > On Thu, Apr 6, 2023, 18: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 ? > > > > > > 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 > > > > > > > > > > > > > > >
Re: Maven slow
Tommy Svensson wrote: > I'm running Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) > That is what the latest version of IDEA gives me. If you add Maven Wrapper [0] to your project, you can use any version of Maven you like, including the latest 3.9.1 release. Nils. [0] https://maven.apache.org/wrapper/ - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven slow
Tommy Svenssonwrote: > I'm running Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) That is what the latest version of IDEA gives me. If you add Maven Wrapper [0] to your project, you can use any version of Maven you like, including the latest 3.9.1 release. Nils. [0] https://maven.apache.org/wrapper/ - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven slow
Hello maven users, I provided an update on this yesterday, but I'm not sure it was sent. My Mac was in a really bad state. The problem is solved, and maven is and was 100% innocent here! :-). There were a new macos update that I missed that solved the general slugishness of my machine. The real culprit here is IntelliJ IDEA! It still takes 43 seconds to build within IDEA. Doing a "mvn clean install" in a terminal takes 7 seconds! A rather extreme diff! This is a multimodule project of about 5 modules. BR, Tommy På 9 april 2023 till 17:00:51, Tommy Svensson (to...@natusoft.se(mailto:to...@natusoft.se)) skrev: > Tommy Svenssonwrote: > > > I'm running Apache Maven 3.8.5 > (3599d3414f046de2324203b78ddcf9b5e4388aa0) That is what the latest version of > IDEA gives me. > > If you add Maven Wrapper [0] to your project, you can use any version of > Maven you like, including the latest 3.9.1 release. > > Nils. > > [0] https://maven.apache.org/wrapper/ > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: Maven slow
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
Re: Maven slow
Hi, That sounds very good.. Tip: Do not use "install" use "verify" instead... Kind regards Karl Heinz Marbaise On 10.04.23 10:50, Tommy Svensson wrote: Hello maven users, I provided an update on this yesterday, but I'm not sure it was sent. My Mac was in a really bad state. The problem is solved, and maven is and was 100% innocent here! :-). There were a new macos update that I missed that solved the general slugishness of my machine. The real culprit here is IntelliJ IDEA! It still takes 43 seconds to build within IDEA. Doing a "mvn clean install" in a terminal takes 7 seconds! A rather extreme diff! This is a multimodule project of about 5 modules. BR, Tommy På 9 april 2023 till 17:00:51, Tommy Svensson (to...@natusoft.se(mailto:to...@natusoft.se)) skrev: Tommy Svenssonwrote: > I'm running Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) That is what the latest version of IDEA gives me. If you add Maven Wrapper [0] to your project, you can use any version of Maven you like, including the latest 3.9.1 release. Nils. [0] https://maven.apache.org/wrapper/ - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven slow
Good point! Most of the builds are just verifications. BR Tommy På 10 april 2023 till 16:32:50, Karl Heinz Marbaise (khmarba...@gmx.de(mailto:khmarba...@gmx.de)) skrev: > Hi, > > That sounds very good.. > > Tip: Do not use "install" use "verify" instead... > > > Kind regards > Karl Heinz Marbaise > On 10.04.23 10:50, Tommy Svensson wrote: > > Hello maven users, > > > > I provided an update on this yesterday, but I'm not sure it was sent. My > > Mac was in a really bad state. > > > > The problem is solved, and maven is and was 100% innocent here! :-). > > > > There were a new macos update that I missed that solved the general > > slugishness of my machine. The real culprit here is IntelliJ IDEA! It still > > takes 43 seconds to build within IDEA. Doing a "mvn clean install" in a > > terminal takes 7 seconds! A rather extreme diff! This is a multimodule > > project of about 5 modules. > > > > BR, Tommy > > > > > > På 9 april 2023 till 17:00:51, Tommy Svensson > > (to...@natusoft.se(mailto:to...@natusoft.se)) skrev: > > > > > Tommy Svenssonwrote: > > > > > > > I'm running Apache Maven 3.8.5 > > > (3599d3414f046de2324203b78ddcf9b5e4388aa0) That is what the latest > > > version of IDEA gives me. > > > > > > If you add Maven Wrapper [0] to your project, you can use any > > > version of Maven you like, including the latest 3.9.1 release. > > > > > > Nils. > > > > > > [0] https://maven.apache.org/wrapper/ > > > - > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org >