Photo by Sincerely Media on Unsplash
How to create a new Java Project using Maven?
Do you want to be a successful Java developer? Here’s how to get started with Maven.
Table of contents
Introduction
In this post, I’ll share how to create a Java Maven project with the FREE highly popular IntelliJ Idea IDE in a matter of seconds.
New Project
Open IntelliJ Idea IDE and click on New Project.
Note that you can download the Free Community version which should be sufficient for most Java development.
In the New Project template, select Maven.
Archetypes
You can also create from archetypes such as Spring Sample or ReactJS.
For this quick example, we are not going to select any archetype.
Enter a name for your project and the GroupId.
By default, IntelliJ Idea creates projects in the IdeaProjects location. You can however choose another one.
POM
Once the project is created, you can see the POM file that contains your dependencies, configurations and plugins.
Using this IDE, there are several ways of installing third-party libraries such as Jackson or Scribe Java.
You can use maven goals or use the Search Artefact menu.
Build
You can then Build your project to see if anything breaks.
New Package
Add a new package. Should normally follow com.organisation.PackageName
Just for a quick example, Auth is enough.
Java Class
Create a new Java class.
The project's main entry point is the main method.
Click on the green arrow to launch the program.
“Hello World”
Creating a new Java project with Maven is straightforward and can be highly productive with the use of Archetypes.
Hi, my name is Abdallah. I'm a Senior Software Developer. I like sharing what I learn because I believe IT can improve people's quality of life. 🙂
Follow me for more tips on Software Development, Test Automation, Productivity and Problem Solving. 🚀