Open In App

Create a New Maven Project from Command Prompt

Last Updated : 14 Dec, 2020
Like Article

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:


<!---contributed by sambhav228------>

Step 4: In the folder structure of the Maven project you can find your DemoMavenProject.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads