Maven Project

A Maven is a build tool, released by Apache as an open source.

Before Maven, the industry has used ANT(Another next tool). It is also a build tool from Apache.

The Maven tool will support Java developers by doing the following things.

  1. It can compile the source code.
  2. It can create a jar/war/ear for a project.
  3. It can automatically download project dependencies
  4. It can generate this selection of test cases, it can compile and run test case
  5. It can automatically deploy a project in a server
  6. It can automatically generate Java documentation for project
  7. It can create a site with project information
Maven project in Eclipse
  1. Click on the eclipse.exe and Open Eclipse.
  2. Select File ->New -> Others -> Option (or) Select File ->New -> Maven Project.

  3. Click on the Maven Project and click the next button

  4. Next, click the check box (create the simple maven project) and click next button.

  5. After that write the Group Id and Artifact Id.(remaining fields are optional).Then Click one finish button

  6. Eclipse will create a maven project for us.Maven project will created at Project Explorer

  7. We will show the below files.You will place your Java code in /src/main/java,resources in /src/main/resources, your testing code and resources in /src/test/java and /src/test/resources respectively.

  8. Click and Open the pom.xml file to view the structure Maven has set up. In this file, you can see the information entered in step IV. You may also use the tabs at the bottom of the window to change to view Dependencies, we can directly get jar files in our project implicitly.

  9. Click on the pom.xml button and you can directly copy any Repository code and get the jar file directly.

  10. How to create the jar file in a Maven Project. Go to project -> Right Click -> Click on the RunAS

  11. Next One page will come.we find the Goals field, then enter the install and Click on the Run.

  12. It will create the jar file at local eclipse work path.