Create a New Maven Project from Command Prompt
Last Updated :
05 Jun, 2024
Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation. It simplifies the build process like ANT. But it is too much advanced than ANT.
In short, maven is a tool that can be used for building and managing any Java-based project. Maven makes the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.
Steps for creating a New Maven Project from Command Prompt:
Step 1: Open Run and type ‘cmd‘ to open Command Prompt.

Step 2: Using 'cd' command, you have to browse to the folder where you want to set up your project and then type the below command:
mvn archetype:generate -DgroupId=ToolsQA -DartifactId=DemoMavenProject -DarchetypeArtifactId= maven-archetype-quickstart -DinteractiveMode=false

In the above command, you are using ‘DartifactId‘ i.e. your project name and ‘DarchetypeArtifactId‘ is the type of Maven project. There are different types of maven projects like web projects, java projects, etc.
Once you press Enter after typing the above command, it will start creating the Maven project
Step 3: After successfully building, once go to the project location to see the newly created maven project. Now open the pom.xml file, which resides in the project folder. By default, the POM is generated like this:
HTML
<!---contributed by sambhav228------>
<project xmlns="https://maven.apache.org/POM/3.2.3"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"https://maven.apache.org/POM/3.2.3 http://maven.apache.org/maven-v3_2_3.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ToolsQA</groupId>
<artifactId>DemoMavenProject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>DemoMavenProject</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Step 4: In the folder structure of the Maven project you can find your DemoMavenProject.
Similar Reads
How to Create a Spring Boot Project? Spring Boot is built on top of the spring and contains all the features of spring. It is one of the most popular frameworks for building Java-based web applications and microservices. It is a favorite among developers due to its rapid, production-ready environment, which allows developers to focus o
6 min read
How to Create a Spring Boot Project with IntelliJ IDEA? Spring Boot is one of the most popular frameworks for building Java applications, and IntelliJ IDEA is a top-tier IDE for Java development. In this article, we will guide you through the process of creating a Spring Boot project using IntelliJ IDEA. Whether you are a beginner or an experienced devel
3 min read
How to Create a Gradle Based Project using CLI? Gradle is a flexible build automation tool to build software. It is open-source, and also capable of building almost any type of software. A build automation tool automates the build process of applications. Using Gradle, we can create Android, Java, Groovy, Kotlin JVM, Scala, C++, and Swift librari
5 min read
How to Create a Project In NetBeans GUI? All Java Development in the IDE takes place within Projects, we first need to create a new project within which to store sources and other project files. An IDE project is a group of JAVA Source files plus its associated metadata (data about data), including project-specific properties files, and ma
2 min read
How to Create a Maven Project in Eclipse IDE? Maven is a powerful project management tool that is based on POM (project object model). It is used for project build, dependency, and documentation. It simplifies the build process like ANT. But it is too much advanced than ANT. In short terms we can tell maven is a tool that can be used for buildi
2 min read
How to Create a Gradle Project in IntelliJ IDEA? Gradle is an excellent open-source construction tool that is capable of the development of any kind of software. It is an automation tool that is based on Apache Ant and Apache Maven. This tool is capable of developing applications with industry standards and supports a variety of languages includin
2 min read