Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to control VM arguments for maven-jetty-plugin?

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.

like image 866
Michal Bernhard Avatar asked Jan 05 '10 15:01

Michal Bernhard


People also ask

What is the Artifactid of the jetty maven plugin?

1.1 The 'groupId' is org. eclipse. jetty , by default, it runs on port 8080, in root context '/'.

How do I use Maven jetty?

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.


1 Answers

The enviroment variable MAVEN_OPTS is the answer. The string content of MAVEN_OPTS is passed to JVM (java.exe).

  • Linux: in shell type export MAVEN_OPTS=....
  • Windows: in shell (cmd.exe) type 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).

like image 155
Michal Bernhard Avatar answered Sep 28 '22 07:09

Michal Bernhard