Maven is a java-based project build tool that automates the build process. To install Maven on any platform, you’ll need a Java development environment. Before installing maven, make sure you have the most recent JDK version installed.
You can check my other posts on maven commands
Install and setup maven on local windows
Download maven software from the apache site and extract the files, copy it to a local drive example D:\java\apache-maven-3.0.3.
Before that, you need to set below environment variables on your local box
set M3_HOME variable to maven home folder(for example D:\java\apache-maven-3.0.3)
add M3_HOME variable to environment variable PATH (ex:- %PATH%\%M2_HOME%\bin)
To know mvn is installed correctly, open the command window and execute the following command,
It shows both the maven and the java versions. The screenshot for this command can be found below.
Install and setup Maven on Linux
Please download the most recent version of Maven from the Maven website. It was downloaded to your local folder as apache-maven-3.5.0-bin.tar.gz. Extract and save to usr/local/apache-maven-3.5.0, then set up maven environment variables.
export M3_HOME=/usr/local/apache-maven-3.5.0 export PATH=$M3_HOME/bin:$PATH
Verify maven installation using mvn --v command
So this is the same process for installation of a maven on Mac and Unix
- Setup java/JDK
- Download the Maven library and extract the local folder
- Setup Environment variables
- Verify using the mvn –v command
Fix for java.lang.OutOfMemoryError issue in maven
Maven compiles, copies, and runs the integration test using the maven installs command. If your project is large, there are too many objects in the heap memory, and this exception will be thrown if the heap memory cannot manage your project’s running object execution object size.
MAVEN_OPTS="-Xmx512m -Xms512m -XX:MaxPermSize=512m"
Please share your comments on this.