Maven has become a de-facto tool for dependency management. A lot of times we need to create maven project. Let’s see how to create a simple Java project using Maven.
- Java 6+
- Maven 3.2.5
Here are few assumptions
Package name = com.codezuzu (used for groupId)
App name = maven-app (used for artifactId)
Creating the Project
We shall run maven in non-interactive mode. Here is the command to create the project
$ mvn archetype:generate -DgroupId=com.codezuzu -DartifactId=maven-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
This shall create our maven project. Here is how it looks on console
Maven shall download few things if not available and shall create the project.
Let’s see how the final structure looks like
Java code goes into src/main/java folder, and test class and relevant code goes into src/test/java