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.
1.1 The 'groupId' is org. eclipse. jetty , by default, it runs on port 8080, in root context '/'.
You need to add [jetty maven plugin]( eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html) in your pom. xml file so you use jetty:run to launch your webapp in maven.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With