Create a Maven Web Project

In this tutorial, we will learn about creating a simple Maven web project using Eclipse and Command line.

Using Eclipse:

Technologies used –

a. Eclipse IDE for Java EE developer (Mars)
b. Preinstalled Maven with Eclipse Mars
c. Java 1.8


1. Go to File > New > Maven Project


2. Click on Next

3. Choose the artifact as shown below:


4. Fill out the details of group id and artifact id. Values in the snapshot are just samples. You can fill out values of your choice.


5. Click on Finish.

A maven based web project is ready now.


Using command line in Mac:

Technologies used –
a.  Apache maven 3.3.3
b. Java 1.8


  1. Download maven from Maven 3.3.3
  2. Unzip the folder in your favorite directory.
  3. In your Home directory, open the file .bash_profile.
  4. Make the following entry :
export M2_HOME=~/Development/apache-maven-3.3.3
export PATH=$PATH:$M2_HOME/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

Note: Please note that ~(tilde) used is my home directory since I downloaded maven in my home directory. Also, version of java used may be different for you and so is your java installation directory. Please make changes accordingly.

    5.  Open command line and type the below command.

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes  -DarchetypeArtifactId=maven-archetype-webapp  -DarchetypeVersion=1.0 -DgroupId=com.javanbeyond -DartifactId=QuickCrashCourse  -Dversion=1.0-SNAPSHOT -DinteractiveMode=false

Please make sure your current directory should be the directory where you want your project to be created.

6. Press Enter and wait for the process to complete.

7. A folder with the name of your artifact Id should get created. Folder structure inside QuickCrashCourse folder.

Back to Top