Maven 3.3.1 included some improvements to allow project specific JVM and command line options, documented in the release notes. Using this it is very easy to maintain consistency between local and CI builds.
Here’s an example of the configuration I would typically use for
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true -DinstallAtEnd=true -DdeployAtEnd=true --errors --fail-at-end --show-version
And something like this for
-Xmx4g -Xms1g -Djava.awt.headless=true
Bear in mind if you’re using containerised builds that any
-Xmx option will
-XX:+UseContainerSupport calculated limits. The JVM is container
aware by default since Java 10, and with the
since Java 8u191.
Also, IntelliJ has an issue
where it is unable to detect successful builds when
is in effect. If you happen to use IntelliJ then you might want to avoid using
this option until that issue is resolved.