Skip to content

Instantly share code, notes, and snippets.

@drkarl
Forked from kra3/maven tips.sh
Last active November 6, 2018 10:54
Show Gist options
  • Save drkarl/405dd42446e03040376b88d238692afc to your computer and use it in GitHub Desktop.
Save drkarl/405dd42446e03040376b88d238692afc to your computer and use it in GitHub Desktop.
Speed up maven build times.
# rip off from https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
# in .bashrc
set MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
# add -DdependencyLocationsEnabled=false to retain fewer outgoing connections.
# compile all modules
mvn -T 1C install -offline
# compile specific module
mvn -T 1C install -pl $moduleName -am -offline
# -T 1C: one thread per cpu core. -T 4 use 4 threads
# -offline: offline mode, does not check for newer snapshots.
# -pl $moduleName: build only specified module.
# -am: build depended modules (use with -pl).
# PS: mvn clean is not used, helps speedup as it's an incremental build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment