There are several things one can do to speed up routine Maven builds - here is a non-exhaustive list of things to try - please let me know which ones work / don't work for you!
-
TODO: (multicore/multithread options!!!)
-
Prepare for offline mode: Tell Maven to download everything you depend on, so you can work offline. See "Offline Mode" for more information about working offline.
mvn dependency:go-offline -
Offline Mode: Tell Maven you are offline, so not to bother checking to see if there are updated dependencies to download, etc. Note: You need to have previously run mvn normally, to make sure dependencies were downloaded at least once.
mvn -o -
Set useIncrementalCompilation=false: This Maven setting is supposedly broken in maven-compiler-plugin 3.1, so although it defaults to "true", in practice this flag's meaning (currently) seems to be inverted, so by setting useIncrementalCompilation=false , we effectively get useIncrementalCompilation=true - got that? :)
See: http://stackoverflow.com/questions/17944108/maven-compiler-plugin-always-detecting-a-set-of-sources-as-stale and https://issues.apache.org/jira/browse/MCOMPILER-209
-
Disable unused plugins on a per-phase basis
-
Other tricks TBD:
-
Declare used and undeclared dependencies (undeclared transitive dependencies - Maven spends time resolving)
-
Remove unused declared dependencies (Maven spends time considering them)
-
Refactor dependency versions into higher level pom.xml or dependencies file.
See: http://www.kyleblaney.com/maven-best-practices/ and: https://maven.apache.org/plugins/maven-dependency-plugin/
- Refactor plugin versions - and their dependencies - into higher level pom.xml or dependencies file.
See: http://stackoverflow.com/questions/11254356/maven-dependency-management-for-plugin-dependencies
-
- http://stackoverflow.com/questions/7233328/how-do-i-configure-maven-for-offline-development
- http://stackoverflow.com/questions/17944108/maven-compiler-plugin-always-detecting-a-set-of-sources-as-stale
- https://issues.apache.org/jira/browse/MCOMPILER-209
- https://developer.jboss.org/people/ozizka/blog/2013/07/06/how-to-speed-up-maven-builds-disabling-unused-plugins?_sscc=t
- http://www.kyleblaney.com/maven-best-practices/
- http://stackoverflow.com/questions/11254356/maven-dependency-management-for-plugin-dependencies
- https://maven.apache.org/plugins/maven-dependency-plugin/
- http://www.ibm.com/developerworks/library/j-5things13/