Setting Variables.
-
On Mac OS X you can edit your .bash_profile file and add the following:
export M2_HOME=/home/martin/apps/apache-maven-3.3.3 export MAVEN_OPTS="-Xms1024m -Xmx1G -XX:PermSize=1024m -javaagent:/home/martin/libs/springloaded-1.2.5.RELEASE.jar -noverify"
Important: Remove -XX:PermSize=1024m if you are using JDK 8, it is only needed for JDK 7.Important: Refer to previous installation sections for in what directory Maven was installed and in what directory Spring Loaded was installed.Restart the terminal session or run source .bash_profile to activate the environment variables.
-
On Linux you can edit your .bashrc file and add the following:
See step 1 for Mac OS, do the same thing for Linux.
Restart the terminal session or run source .bashrc to activate the environment variable.
-
On Windows, the exact procedure for setting environment variables varies
depending on the version of Windows you are running. For example, the procedure
for Windows XP can be found in the Microsoft Knowledgebase.
set M2_HOME=C:\Tools\apache-maven-3.3.1 set MAVEN_OPTS=-Xms256m -Xmx1G -XX:PermSize=1024m -javaagent:C:\Tools\spring-loaded\springloaded-1.2.5.RELEASE.jar -noverify
Important: Remove -XX:PermSize=1024m if you are using JDK 8, it is only needed for JDK 7.Important: If the path to the Spring Loaded JAR contains spaces, then you might need to double quote it like -javaagent:"C:\My Tools\spring-loaded\springloaded-1.2.5.RELEASE.jar". Refer to previous installation sections for in what directory Maven was installed and in what directory Spring Loaded was installed.Restart the Windows terminal/console session.
Verifying Variables.
-
Ensure that the MAVEN_OPTS and M2_HOME environment variables are set
correctly, using a method suitable for your system. For example, on Mac OS X and
Linux you can enter the following command:
$ env|egrep "M2|MAV" MAVEN_OPTS=-Xms256m -Xmx1G -XX:PermSize=1024m -javaagent:/home/martin/libs/springloaded-1.2.5.RELEASE.jar -noverify M2_HOME=/home/martin/apps/apache-maven-3.3.3
Ensure that the result matches the value you specified in your shell configuration file (such as .bashrc).
If you are on Windows you can use a command such as set M to display environment variables starting with 'M'.
C:\Users\mbergljung>set M M2_HOME=C:\Tools\apache-maven-3.3.1 MAVEN_OPTS=-Xms256m -Xmx1G -XX:PermSize=1024m -javaagent:C:\Tools\spring-loaded\springloaded-1.2.3.RELEASE.jar -noverify