Is there a way to pass jvm args via command line to maven?

Charlotte Tan picture Charlotte Tan · Sep 21, 2012 · Viewed 144.9k times · Source

Possible Duplicate:
maven jetty plugin - how to control vm arguments?

In particular, I want to do something like this:

mvn -DjvmArgs="-Xmx2000m -Xms1000m -XX:PermSize=512m -XX:MaxPermSize=512m" jetty:run -Pmyprofile

Oh, and I would like to do this without having to modify the pom files or set any environment variables.. etc

Answer

Nishant picture Nishant · Sep 21, 2012

I think MAVEN_OPTS would be most appropriate for you. See here: http://maven.apache.org/configure.html

In Unix:

Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.

In Win, you need to set environment variable via the dialogue box

Add ... environment variable by opening up the system properties (WinKey + Pause),... In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.