How to Create a Maven Project in Eclipse for Beginners |Video upload date:  · Duration: PT15M7S  · Language: EN

Step by step guide to create a Maven project in Eclipse using basic POM and archetype approaches for beginners

If you want to make a Maven project in Eclipse and still have time for coffee this guide will hold your hand and mock you gently. This tutorial covers using the Eclipse Maven integration m2e the POM file and archetypes so you can stop guessing where the build broke and start blaming the right dependency.

Before you twist the IDE

Make sure Eclipse has the m2e plugin installed. If not open the Marketplace in Eclipse and add Maven integration. No dramatic terminal spells needed. Once m2e is present the New Project wizard becomes the friendly monster that creates folder structure and a pom.xml for you.

Start a new Maven project

  • File and New and Maven Project in the IDE. Pick a workspace folder that does not have spaces if you enjoy fewer surprises.
  • When asked choose either an archetype for a quick skeleton or an empty project for manual POM work. Archetypes save typing and future regret.
  • Set the coordinates using reverse domain style groupId such as com.example set a clear artifactId and accept the default version 1.0 snapshot unless you like chaos.

What the wizard produces

Eclipse will generate a standard Maven layout and a pom.xml file. Think of the POM as the brain of the build system. Open it and look for project coordinates dependencyManagement and the dependencies section. If something looks wrong the IDE will usually offer quick fixes.

Edit the POM like a responsible adult

To add a library provide its groupId artifactId and version. For example to add Apache Commons Lang you would add an entry with groupId org.apache.commons artifactId commons-lang3 version 3.12.0. For plugins add the maven compiler plugin and set the Java source and target to match your JDK. The IDE helps with auto completion so you do not have to memorize everything.

Common plugin hints

  • maven compiler plugin set source and target to 11 or to whatever your project needs
  • Surefire or Failsafe for tests so unit tests run during the default build lifecycle
  • Use dependencyManagement only for multi module projects so you do not duplicate versions all over creation

Build and run without crying

From a terminal run mvn clean package to build a jar or run mvn test to run unit tests. From Eclipse right click the project and choose Run As and Maven build then enter goals such as clean package and hit run. The IDE will show the console output and any failing tests or dependency conflicts.

Troubleshooting that saves you time

  • If dependencies do not resolve use Maven and Update Project from the context menu in Eclipse to force a reimport from the remote repositories.
  • Check the installed JRE and project Java compliance if compilation fails after a dependency update.
  • If m2e reports lifecycle mapping issues install connectors from the Marketplace or configure the plugin execution in the POM with a known m2e friendly mapping.

Final tips for adults

Use archetypes for quick prototypes and empty projects when you want full control. Keep the POM tidy use dependencyManagement for shared versioning and prefer explicit versions for production builds. Treat the POM as code and commit it early so your future self stops blaming coworkers for missing jars.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.