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 .mvn/maven.config
-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 .mvn/jvm.config
-Xmx4g
-Xms1g
-Djava.awt.headless=true
Bear in mind if you’re using containerised builds that any -Xmx
option will
override any -XX:+UseContainerSupport
calculated limits. The JVM is container
aware by default since Java 10, and with the -XX:+UseContainerSupport
option
since Java 8u191.
Also, IntelliJ has an issue
where it is unable to detect successful builds when org.slf4j.simpleLogger.showDateTime=true
is in effect. If you happen to use IntelliJ then you might want to avoid using
this option until that issue is resolved.
-Dorg.slf4j.simpleLogger.showDateTime=true
-Dorg.slf4j.simpleLogger.dateTimeFormat=...