In the previous tutorial, I have explained How to create Maven Java project in Intellij without Command Line. In this tutorial, I will explain about creation of Java Maven Project using Command Line in IntelliJ.
Step 1 – Open IntelliJ IDEA IDE. Click on Terminal Button as shown in the below image.
Step 2 – Go to the path where you want to create the project. This can be done by typing command
cd path of folder
Step 3 – This tells Maven to generate a Java project from a Maven template.
Step 4 – We need to mention the number as displayed on your screen in Command Prompt to proceed further. Like here, Choose a number or apply filter has 1771, so I have also mentioned 1771 in command prompt.
Step 5 – We need to provide again input in command prompt. This time program wants to know which version we want to use. I prefer to use the latest version. Here, it is 8, so I have selected version 8.
Step 6 – We need to provide 2 input here
A) Value of groupId – This serves as the group identifier of your Maven project, it should be in a form similar to Java packages, such as com.example
B) Value of artifactId – This serves as the group-local identifier of my Maven project like MavenIntelliJFromCMD
C) Value of Version – The initial version of our project. The default is 1.0-SNAPSHOT
D) Value of package – The name of our root package. The default is groupId we have created earlier.
We will notice the INFO message about the properties.
If the displayed settings are correct, then just enter Y in :: prompt.
Step 7 – Successful Build – Below screenshot shows that the Maven IntelliJ Project built successfully.
Step 8 – Contents of Project Folder – Open folder MavenIntelliJFromCMD to see the contents of the folder. It should have POM file and src.
This project can be imported in IntelliJ and can be used further. To know how to import Java Maven project in Intellij, click here.
That’s it! We have created a Maven Project in IntelliJ using Command Line.
Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!