Home Cd software Download and install Maven on Windows 10 or 11 via the command line

Download and install Maven on Windows 10 or 11 via the command line



Learn about the download guide steps and how to install Apache Maven on Windows 10 or 111 using PowerShell or Command Prompt.

Maven is based on a declarative, model-driven approach to achieve the build process. Instead of implementing individual building goals. With the “Apache Maven” tool, building management of software projects becomes much more efficient, secure and transparent.

Especially when proceeding according to the continuous integration model, a software project requires a permanently stable version of the code. With the Maven build tool, you can automate the process of creating a stable build version.

The process follows a canned cycle that you can adapt to your specifications, meaning you don’t have to fully integrate it. However, it is particularly advisable to include all components in distributed project teams. The process is configured using POM files. These are XML files that define the process and the dependencies.

In addition to testing, resolving dependencies and of course building, you can always monitor the current state of the build with Maven. This way you and the other developers always know the quality and completeness of the current version.

Steps to install Apache Maven on Windows 10 or 11 via command

1. Open Powershell or Windows Terminal

As here we will use the pure command line method to download and install Apache Maven, therefore, depending on your Windows system, run the command line application under administrative rights.

To run the CLI application, all you have to do is right click on the Windows start menu, then on Windows 10, You will have PowerShell (Admin) to select while the Windows 11 user will have Windows Terminal (administrator), by default.

2. Install Chocolatey on Windows 10/11

Now just on your Windows Terminal or Powershell copy and paste the command below and hit enter key. This will install the Chocolatey package manager on your system.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Once the installation is complete, close the Powershell (Admin) or the Terminal (Admin) and open do it again.

3. Command to install OpenJDK

As we know, Apache Maven needs Java because it is the only key system requirement to properly run this tool on your system. Therefore, if you already have JAVA on your Windows system, you can to jump this step. However, make sure that the Java_Home path is in your system environment variable. If you don’t have a JDK, run the command below:

choco install openjdk

Command to install OpenJDK on Windows 10 11

Once the process is finished, close the PowerShell (admin) or Windows (admin) terminal you are using and open again so that it can recognize the Java path.

4. Download and install Apache Maven on Windows 10/11

Now run the final command which will automatically download and install Apache Maven on your Windows system without any difficulty. This will also recognize the installed Java and its environment variable.

choco install maven

Command to install Apache Maven on Windows 10 or 11

5. Check the Maven version or command

To check if the Maven was installed only on our system successfully and know its version, you can use the following commands.

mvn --version
mvn --help

Apache Maven Windows command to verify

6. Create your first project

Well, those who are familiar with Maven will already know what to do to create a project, while newbies can check out the official Apache Maven website for more on how to handle it. However, just to give an idea of ​​how to get started with this tool, here are the commands:

Create a project

Paste the given command into your terminal. You override the Group ID, Artifact ID, and other values ​​as desired.

mvn archetype: generate “-DgroupId = com.mycompany.app” “-DartifactId = my-app” “-DarchetypeArtifactId = maven-archetype-quickstart” “-DarchetypeVersion = 1.4” “-DinteractiveMode = false”

To note: On Windows we need to use all parameters in quotes otherwise you will encounter the following errors:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:Usersh2sraj). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

Switch to your App directory: here is my-application

cd my-app

For more information, please consult the official documents on the construction of the Maven project.

Create a Maven project



Please enter your comment!
Please enter your name here