Packaging and deploying artifacts or projects is one of the most critical and frequently performed steps in the current era. So we would like you to know that build tools like maven, gradle, ant and etc.. share a great stake in DEVOPS cycle. And, now in this article we will look at steps to setup and configure maven environment in a windows machine.
Some times these activities are automated or pre-configured. And in case you want to setup and configure maven environment on your own, kindly continue.
There are around 3 steps that you need to configure your windows machine for this, which are as following
- Install Maven software on windows machine
- Add and configure M2_HOME and M2 system variables
- Add maven bin folder to your “Path” variable
Detailed steps to setup and configure maven environment
1. Steps to install Maven software on windows machine
- You can download the maven software from following link, as you are working on windows machine, you need to download the zip folder.
- Unzip the folder and keep it under “C:\Program Files\maven”
- Make sure the path is “C:\Program Files\maven\bin”
2. Add and configure M2_HOME and M2 system variables
- Navigate to your windows “Environment Variables” screen
- Add the following two variables under System Variables
Also, In case you do not have “JAVA_HOME” environment variable, kindly add it as shown below. Value is the path to JDK installed directory.
3. Add “maven’s bin” folder to path variable
- In the same “Environment Variables” screen & under system variables section.
- Select the “Path” variable and click on Edit button
- Add the path as shown below and click OK to close
Now you are done with the steps to setup and configure maven environment in a windows machine.
Kindly perform the following steps to validate if entire setup is as required
- Open command prompt
- Give the command “mvn” without double quotes
- Make sure that you did not get command not recognized error.
- Please do not worry, if you are getting following error. And, actually this is what we are supposed to get for the first time.
Hope this article has helped you to setup the environment to build with maven tool.