In this post, We will learn How to create a maven project using the command line
Step 1: Create a folder/directory with any name in your favorite local derive and open the command. Make sure your command prompt is pointing to that folder/directory
For Example, I have created a folder named: MyWorkspace in C drive after that opened command prompt which is pointing to C:\MyWorkspace
Step 2:Now you to type the below command on the command prompt and press Enter
You will see the maven provides a lot of artifactId and it also shows the corresponding description. Now we have to select artifactId to create a project. Here Maven also recommends choosing artifactId 1674. if you scroll up then you can see which kind of project we can create using artifact id 1674
1674: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
Note: ArtifactId 1674 is used to create a sample maven project. If you want to create a Web project java project or other types of java project then you need to choose the appropriate artifact id among the provided artifactId list.
Step3: Here just for this demo purpose either directly you press enter or type artifactId 1674 and press Enter
Now we have to Choose org.apache.maven.archetypes:maven-archetype-quickstart version: as you can see in above image.
Here Maven is recommending to choose 8 so either directly you can press Enter or Type 8 and press Enter
I have types 8 and press Enter.
You have to enter a value for groupId,artifactId, version, and package and press enter. like below
‘version’ 1.0-SNAPSHOT: : 1.0-SNAPSHOT
‘package’ com.kkjavatutorials: : com.kkjavatutorials
Finally, You have to press Y and press Enter for confirmation
If you see a message BUILD SUCCESS That means the java maven project is created successfully.
If you go to your MyWorkspace and then inside of the project(MyDemoProject) you will observe the pom.xml file is present in the project root directory that means it is a maven project.
That’s all about How to create a maven project using the command line?
You May Also Like:
What is Maven?
How to install and setup Maven Environment on windows?
How to import the maven project in Eclipse?
How to Create a New Maven Project in Eclipse
How to create a maven web application project in Eclipse
How to create a multi-module project using maven?
How to Fix missing src/main/java & src/test/java folders in the Eclipse Maven web Project?
How to create user-defined properties in Maven?
What is the maven local repository location & how to change it?
How to add or update the maven settings.xml file in eclipse?
Importing maven remote Archetype Catalogs in eclipse ?
What is POM in the maven Project?
What is Super POM in Maven Project?
Understanding the purpose of Maven Plugin
Compiling the Maven project with different JDK versions?
Understanding of settings.xml in maven
How to enable a proxy setting in Maven?
Maven Dependency Scopes
How to generate javadoc in the maven Project
How to create a runnable JAR file with Maven?
How to add local jar files to a Maven project?
How to convert an existing Java Project to Maven in Eclipse?
How to exclude dependency in maven?
Managing External Dependencies in maven
Understanding of Maven Repositories
What is an archetype in Maven?
Snapshot Vs Version in maven
Apache Maven – Profiles
If you have any feedback or suggestion please feel free to drop in below comment box.