Though not a direct programming question, it is related to Maven and JVM
While I was going thru this link - http://maven.apache.org/archives/maven-1.x/reference/command-line.html
Update of links: https://wiki.openstack.org/wiki/Documentation/Troubleshooting
https://maven.apache.org/docs/3.0/release-notes.html
it says about MAVEN_OPTS
"Specify additional options using the MAVEN_OPTS environment variable. It is for passing parameters to the Java VM when running Maven. For example, to increase the amount of memory to 1024 Meg for the entire run of Maven, use: MAVEN_OPTS=-Xmx1024m "
Questions: How Maven is able to set the JVM properties? Why does Maven need JVM? It just build the war and JVM is needed only when u deploy the WAR to appserver.right? Does Maven starts the JVM and stop it after use? IF it stops it after use, what's the point in setting more heap size?
My understanding after research:
(1) How/Why Maven is able to set the JVM properties?
(2) Why does Maven need JVM? Maven is just a build tool..
javac -d build/classes -classpath ... -J-Xms256m -J-Xmx1024m java-source-files
](3) Does Maven starts the JVM and stop it after use? IF it stops it after use, what's the point in setting more heap size?
Please clarify on my understanding especially on the second question
mvn
is a shell script/batch file, and it uses MAVEN_OPTS
to do what you'd expect.To further clarify point 1, this is what happens at the end of the script:
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${CLASSWORLDS_LAUNCHER} "$@"
Note: why read Maven 1 docs?