Thursday, October 10, 2024

Creating a Maven Project in Eclipse

This tutorial shows how to create a Maven project in Eclipse. Here I am using the maven Eclipse plugin. These days Eclipse comes pre-configured with maven plugin and you don't need to download and set up maven plugin yourself. To verify that you have maven plugin pre-configured in eclipse go to Windows - Preferences, there on the left side scrollable window search for Maven, if you have maven then it will look like this.

maven project in eclipse

Creating Maven project structure in Eclipse

In Eclipse select File - New - Maven Project

That will open a Wizard for creating “New Maven Project”, check “Create a simple project (skip archetype selection)”. Click Next.

Maven project eclipse

In the next window provide group ID and artifact ID and other details.

  • groupId- This element indicates the unique identifier of the organization or group that created the project. GroupId is typically based on the fully qualified domain name of your organization. For example com.companyName.finance is the designated groupId for all finanace related projects.
  • artifactId- This element indicates the unique base name of the primary artifact being generated by this project. The primary artifact for a project is typically a JAR file. A typical artifact produced by Maven would have the form -. (for example, myapp-1.0.jar).
  • packaging- This element indicates the package type to be used by this artifact (e.g. JAR, WAR, EAR, etc.). The default value for the packaging element is JAR so you do not have to specify this for most projects.
  • version- This element indicates the version of the artifact generated by the project.
  • name- This element indicates the display name used for the project. This is often used in Maven's generated documentation.
  • description- This element provides a basic description of your project. This is often used in Maven's generated documentation.
Maven project in Eclipse

Click Finish. You should get a project structure similar to as shown below.

You can change the default JRE system library to current Java version by going to Java build path and changing the JRE library.

That's all for this topic Creating a Maven Project in Eclipse. If you have any doubt or any suggestions to make please drop a comment. Thanks!

>>>Return to Java Advanced Tutorial Page


Related Topics

  1. Spring Example Program Using XML Configuration
  2. Spring Example Program Using JavaConfig And Annotations
  3. Spring Example Program Using Automatic Configuration
  4. Autowiring Using Annotations in Spring
  5. How to Pass Command Line Arguments in Eclipse

You may also like-

  1. Encapsulation in Java
  2. Interface Default Methods in Java
  3. Difference Between Abstract Class And Interface in Java
  4. How to Sort an ArrayList in Descending Order in Java
  5. Java CountDownLatch With Examples
  6. Check Given Strings Anagram or Not Java Program
  7. Add Double Quotes to a String Java Program
  8. Spring NamedParameterJdbcTemplate Insert, Update And Delete Example