Tuesday, January 28, 2020

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.

By default JRE system library is Java 5 to change it to current Java version you can go to Java build path and change 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 8
  3. Difference between abstract class and interface
  4. How to sort an ArrayList in descending order
  5. CountDownLatch in Java concurrency
  6. Check if given strings are anagram or not
  7. How to add double quotes to a String
  8. Insert\Update Using NamedParameterJDBCTemplate in Spring Framework