Java – Why maven so slow compared to automake

buildsjava

I have a Maven project consists of around 100 modules. I have reason to decompose the project to so many modules, and I don't think I should merge them in order to speed up the build process.

I have read a lot of projects by other people, e.g., the Maven project itself, and Apache Archiva, and Hudson project, they all consists of a lot of modules, nearly 100 maybe, more or less.

The problem is, to build them all need so much time, 3 hours for the first time build (this is acceptable because a lot of artifacts to download), and 15 minutes for the second build (this is not acceptable).

For automake, things are similarly, the first time you need to configure the project, to prepare the magical config.h file, it's far more complex then what maven does. But it's still fast, maybe 10 seconds on my Debian box. After then, make install requires maybe 10 minutes for the first time build. However, when everything get prepared, the .o object files are generated, they don't have to be rebuild at all for the second time build. (In Maven, everything rebuild at everytime.)

I'm very wondering, how guys working for Maven projects can bare this long time for each build, I'm just can't sit down calmly during each time Maven build, it took too long time, really.

Best Answer

What part of your maven build is taking the longest? You may find that javac is your main bottleneck. Perhaps it's the unit test execution, try running your tests in parallel. Without more details it's really hard to give a useful answer. How big are the projects?

Are the builds fairly parallelizable? If you are using maven 3 (or switch to it, it's 99% compatible with 2.x) you can run parallel builds.

I think your blame for maven is misplaced, as far as performance is concerned it really doesn't add much overhead. I've converted several large projects and seen the builds speed up considerably.