Arslan Anwar
Arslan Anwar

Reputation: 18746

how to decrease build creation time with Maven

I am using Maven in my project with 6 library projects. It take much time for maven to compile and create build. On my i-5 machine its taking 6-7 Mints

 -------------------------------------------
 BUILD SUCCESS
 -------------------------------------------
 Total time: 8:29.254s
 Finished at: Tue Sep 24 13:25:45 PKT 2013
 Final Memory: 23M/223M
 -------------------------------------------

I wonder if there is way that allow maven to compile only project code/res each time instead of compiling each library again and again for the project. I am sure if so then build time will be much decrease

Any one have idea? Or suggestions?

Upvotes: 2

Views: 2045

Answers (2)

Vinay Lodha
Vinay Lodha

Reputation: 2223

You can use Eclipse Filesync plugin to achieve this. You can configure plugin to map maven output folder to Application server directory

have a look at this Integrating tomcat and eclipse as a hot-deploy environment

One more way is use -DskipTests=true option

Also if possible upgrade your device with SSD. Greatly reduces time

Upvotes: 1

Shaun
Shaun

Reputation: 398

Here's some information about what you have just explained to me (click here). Maven is able to decrease build time but it relies on target content for this. If you don't "clean" the target directory, only out of date modules are rebuilt. Issue is not cleaning the target directory may lead to strange results because of deprecated uncleaned resources.

The incremental-build-plugin provides a solution for this: checking the target content during the Maven validation phase, it deletes the target directory when it's needed.

This plugin is automatically activated when using Nuxeo corporate POM (org.nuxeo:nuxeo-ecm since version 5.4.0-SNAPSHOT).

You don't need to "clean" anymore while building sources.

Note that when using for instance "mvn install", even if a module is not rebuilt, its target content is installed; which is a good thing for SNAPSHOT consistency but leads to a consequent build time even if there's nothing to recompile.

Upvotes: 3

Related Questions