Creating a simple project with Maven

Now that we have set up Maven on our favorite operating system and verified that it works fine, it is time to create a simple Java project.

Maven makes it easy to bootstrap a new project by creating a bunch of files and folders following accepted conventions.

How to do it...

Let's start creating the first simple project using Maven, by performing the following steps:

  1. Open a command prompt and change the directory to the folder in which you want to create your first Maven project.
  2. Run the following command:
    mvn archetype:generate -DgroupId=com.packt.cookbook -DartifactId=simple-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
    

    You can change the groupId and artifactId values in the preceding ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.