Java development productivity tips

Written by Kees van Dieren

Some tips to be better productive as Java Developer.

Select correct jvm automatically

Select the correct JVM automatically with jEnv. This tool allows you to switch between different Java versions.

jenV for Windows is also available

Faster maven builds with parallel execution

Maven builds can be slow. Speed them up with parallel execution.

What can be done in parallel?

  • multiple modules: mvn -T 4 clean install will build 4 modules concurrently.
  • multiple tests within a module: mvn -T 4 -DforkCount=1 -DthreadCount=4 -Dparallel=classes will run 4 concurrently.

You can set these options in your MAVEN_ARGS environment variable, and set it in your .bashrc or .zshrc script:


# Faster Maven execution
#
# threadCount doesn't do anything on M1 Mac with arm java; forkCount does affect performance
# Most of our projects don't have many modules which can be build in parallel, so having 2 is enough for -T
export MAVEN_ARGS="-T 2 -DforkCount=4 -Dparallel=classes"

Verifying that it works can be done by veryfing build output contains Wall Clock.

Sequential build:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:09 min
[INFO] Finished at: 2025-06-23T22:53:11+02:00
[INFO] ------------------------------------------------------------------------

Parallel build:


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:44 min (Wall Clock)
[INFO] Finished at: 2025-06-23T22:55:35+02:00
[INFO] ------------------------------------------------------------------------

Kees van Dieren, Squins

Kees van Dieren

Since 2006 we have helped organisations grow with well-built software and honest advice.

Facing a technical challenge?

Get in touch