The global build of our application (30 Maven modules) is taking too much time (15 minutes). This includes units and integration tests. The majority of the time is consumed by the integrations tests (60%).
Our tech stack comprises of Spring, Spring MVC, Spring Batch etc. and Maven. Our developers are not motivated to keep this practice (Build All before commit)
Since I want to improve the build time I am suggesting these scenarios:
mvn -T 1C
is not going to work as this consumes
all resources of developer machine which prevents the developer from
doing other things. front, batch, connector, commons
) is not going to work either as our modules are inter-dependent and we
must do the build all.Do you have some suggestions to improve the build time of large projects?
Thanks in advance.
Adjust memory configurations to optimum for eg: add this line to mvn.bat set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=256m
Clean phase of mvn normally deletes target folder. Instead if we are renaming target folder the cleaning phase will be much faster.
-Dmaven.test.skip=true will skip the test execution.
Add -Denforcer.skip=true to mvn command line argument (This is enforcing versions of maven, jdk etc ,we can skip it after initial runs)
Disable non-critical operations during build phase: Analysis, javadoc generation, source packaging. This will save huge time.
Spawnig new process also helps in time improvement -Dmaven.junit.fork=true (fork the junit tests into a new process) -Dmaven.compile.fork=true (forks the compilation)
Hope it helps.
Don't run the integration tests in the normal profile, let the developers check in after running unit tests only.
Run integration tests on a separate server (a build server or continuous integration server, like Jenkins or similar). Have the build server email the developers that checked in bad code.
In our work office, we also have big screens showing green/yellow/red flags for each module, so everyone can see if a module is unstable (and who has checked in since the last stable build).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With