In this tutorial, you will learn how to create a Maven project in IntelliJ. Maven allows you to build, report, and document the software project.
To create a Maven project in IntelliJ, open the IDE and select File > New > Project. On the window that opens, select New Project to fill in the project details.
Enter the project name as HelloWorld in the section labeled Name. Select the project location in the section labeled Location.
In the Language section, select Java as the programming language for this project. Note that the following section, asks you to select the Build system for the project. Select Maven since you want to create a Maven project.
IntelliJ auto detects the JDK section if you have installed it and added it to the system path variables.
Toggle the Advanced Settings section and enter the GroupId as com.javawhizz. The ArtifactId is the same as the project name and IntelliJ will fill it for you once you enter the name of the project.
If the IDE does not show any errors, your project should be as shown below.
Finally, press the Create button to generate your Maven project. IntelliJ will create the project template for you including the main class and a pom.xml file. Wait for some time for the application to resolve the Maven dependencies.
The following is the initial structure of the pom.xml file generated by IntelliJ.
The main class generated by IntelliJ contains one statement to print “Hello world!”. Below is an image showing the contents of the main class.
In this tutorial, you have learned how to create a Maven project in IntelliJ for a Java application. The process to create a Gradle application is the same but ensure you select the Build system as Gradle.
For a console application, select IntelliJ as the Build system. In the next tutorial, you will learn how to create a Spring Boot project using IntelliJ.
If this article saved you the hassle, check out more tutorials like this in the blog section.