Tech News
Download and install Maven on Windows 10 or 11 from the command line
Learn the steps in the guide to download and install Apache Maven on Windows 10 or 111 using PowerShell or Command Prompt.
Maven is based on a model-based, declarative approach to realize the building process. Instead of implementing the individual building targets. The “Apache Maven” tool makes building management of software projects significantly more efficient, secure and transparent.
Especially when working according to the continuous integration model, a software project requires a permanently stable version of the code. The Maven build tool allows you to automate the process of creating a stable build version.
The process follows a fixed cycle that you can adapt to your specifications, meaning you don’t have to integrate it completely. However, it is highly recommended to include all components in distributed project teams. The process is configured using so-called POM files. These are XML files that define the process and its dependencies.
In addition to testing, dependency resolution, and of course compiling, thanks to Maven you can always track the current build status. This way you and 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
Because here we are going to use the pure command line method to download and install Apache Maven, therefore, according to your Windows system, run the command line app with administrator privileges.
To run the CLI app, all you need to do is: right click on the Windows Start Menu, and then further Windows 10, you will have PowerShell (Admin) to select while the Windows 11 user Will get Windows terminal (administrator), default.
2. Install Chocolatey on Windows 10/11
Now simply copy and paste on your Windows terminal or Powershell the below command and press the enter key. This will install 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 to the Powershell (Admin) or Terminal (Admin) and Open weather.
3. Command to install OpenJDK
As we know the Apache Maven needs Java as it is the only major system requirement to run this tool properly on your system. So if you already to have JAVA on your Windows system, you can: to skip 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
Once the process is complete, close to the PowerShell (admin) or Windows terminal (admin) you are using and Open it again so that it can recognize the Java path.
4. Download and install Apache Maven on Windows 10/11
Now run the last command which will download and install the Apache Maven on your Windows system automatically and without any hassle. This also recognizes the installed Java and its environment variable.
choco install maven
5. Check the Maven Version or Command
To check if the Maven has only been successfully installed on our system and to know its version, you can run the following commands.
mvn --version mvn --help
6. Create your first project
Well, those familiar with Maven should already know what to do to create a project, while the novices can check out the official Apache Maven website for more information on how to mess around with it. Nevertheless, to give you an idea of how to get started with this tool, here are the commands:
Create a project
Paste the given commander from your terminal. You replace the group ID, artifact ID, and other values of your choice.
mvn archetype:generate “-DgroupId=com.mycompany.app” “-DartifactId=my-app” “-DarchetypeArtifactId=maven-archetype-quickstart” “-DarchetypeVersion=1.4” “-DinteractiveMode=false”
Remark: In Windows, we must enclose every parameter in quotes, otherwise you will face 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] [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] [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-app
cd my-app
For more information, see the official documentation on the construction of the Maven project.
News Online 100 (FilmyOne.com) – Exclusive Entertainment Site