Installing Apache Maven under Windows

Install Apache Maven locally on your Windows machine according to the following procedure.

Prerequisites:

  • Maven 3.2 or above
  • Java JDK 1.8

Download the Maven's zip file from the official Maven website, and download the Maven zip file (Maven 3.2 or above), and unzip it to the directory in which you wish to install it (such as C:\Program Files\Apache\maven) Windows Environment Variables: Make sure Java 8 JDK is installed, and JAVA_HOME variable is added as Windows environment variable.

Add the MAVEN_HOME variable in the Windows environment, and point it to your Maven install folder:

Update PATH variable for the system, append Maven bin folder – %MAVEN_HOME%\bin, so that you can run the Maven's command everywhere.

To verify, run ‘mvn –version’ in the command prompt.

If you see a similar message, it means the Apache Maven is installed successfully on Windows.

Any endpoint that is doing dependency resolution needs to be able to access the Maven .m2 folder. You can change this in the settings.xml file that located in the Maven install folder. An example change modifying the local repository to C:/M2 is shown below.

Endpoint examples:

  • Jenkins agents
  • CLI
  • GitLab Runner calling python script that uses REST API

.