First, download Maven and unzip it to your desired installation directory, for example C:\maven in windows, or /usr/local/maven in Linux. After this, add the system variable M2_HOME as well as the $M2_HOME/bin directory to your system path. Type the following in a terminal or command prompt:
If you have just installed Maven, it may take a while on the first run. This is because Maven is downloading the most recent artifacts (plugin jars and other files) into your local repository. You may also need to execute the command a couple of times before it succeeds. This is because the remote server may time out before your downloads are complete. Don’t worry, there are ways to fix that.
You will notice that the create goal created a directory with the same name given as the artifactId. Change into that directory.
The pom.xml file is the core of a project’s configuration in Maven. It is a single configuration file that contains the majority of information required to build a project in just the way you want. The POM is huge and can be daunting in its complexity, but it is not necessary to understand all of the intricacies just yet to use it effectively.