views:

523

answers:

3

How to set vmargs for jetty runned from maven-jetty-plugin?

I need for example to pass -Xmx argument to Jetty which run as maven-plugin (maven-jetty-plugin) by "mvn jetty:run" command.

A: 

How about: mvn -DMAVEN_OPTS=-Xmx1024m jetty:run

Tim Drisdelle
+1  A: 

It seems like your current approach is correct - when running jetty through maven, jetty is a thread inside the maven process. So increasing maven's heap will increase jetty's heap.

How are you setting MAVEN_OPTS?

One example I found looks like this: MAVEN_OPTS='-Xmx256m -Xms10m' mvn clean jetty:run

Note that MAVEN_OPTS is an environment variable here, and not passed to the JVM (who wouldn't know what to do with it).

danben
A: 

Eviroment variable MAVEN_OPTS is the answer. The string content of MAVEN_OPTS variable 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" to set heap space size of maven process to 1024mb*

Michal Bernhard