Gradle Build Time is more than Maven


I am migrating a Maven3 Project to Gradle. The project is very large. It has many levels which are under the home folder. All the subprojects have java code and unit test cases to execute and of course has some jar dependency.

As of now, Gradle build is working fine for one of those levels which has 75 sub - projects underneath.

As I understand, Gradle supports incremental builds and should take less time to build than the Maven.

However, if I execute gradle clean biuld first time it takes less time than Maven, but on successive execution the Gradle and Maven build times are almost the same. Sometimes Gradle takes more build time than the Maven

Even with daemon and parallel execution, the build times are almost the same.

The main reason to migrate to Gradle for this project is to reduce the unnecessary build time required for small changes in the code.

Please let me know your inputs.

It is hard to say without having a look at your build script why the incremental build is slow for you. You could try to run your build with --profile enabled to see the hotspots of your build. Especially check for expensive operations configuration time. Do you use custom plugins or complex logic in your build.gradle file to setup things? or is it mostly standard java/web projects you’re building without custom logic attached? If you could share that --profile html report here it would be helpful as an input too.

Just to be sure. Are you continuing doing clean builds? You get the incrementalness only when you are not doing a clean.