Starting a New Project
Learn how to start a new project with Maven.
We'll cover the following
Introduction
There is a simple way to create a new configuration file (pom.xml
) and project folders using the archetype:generate
command:
mvn archetype:generate
This will list all of the different types of projects we can create. Pick a number representing the type of project you want. Then answer some questions regarding the name of your project. After that process, run the following command to build the project:
mvn package
If we want to use any additional third party libraries, we will have to edit the POM to include each dependency. Fortunately, most IDEs make it easy to add dependencies to the POM.
Lifecycle
Maven uses a declarative style, while Antuses a more imperative approach. This means that instead of listing the steps to take, we describe what should happen during certain phases of the build. The main phases in Maven are as follows:
Get hands-on with 1400+ tech skills courses.