How to set VM arguments for Jetty run from maven-jetty-plugin?
For example, I need to pass -Xmx
arguments to Jetty run by the mvn jetty:run
command.
The enviroment variable MAVEN_OPTS is the answer. The string content of MAVEN_OPTS is passed to JVM (java.exe).
export MAVEN_OPTS=....
set MAVEN_OPTS=...
For example: on Windows set MAVEN_OPTS="-Xmx1024m"
sets the heap size of the Maven process to 1024mb.
Update (01.04.2013): Pass it directly to Jetty.
Matthew Farwell (please upvote his answer to give him credit) comes with the solution of using a forked JVM process to run Jetty which is a new feature of the Jetty plugin. This is a better solution as the former runs inside same JVM process as Maven (thus shares memory).