Hi friends, In this tutorial, I will guide you step by step about how to create Maven project in Eclipse IDE. The Eclipse IDE provides nice and excellent support for Maven. If you do not have Maven installed in Eclipse IDE then I advise you to install it first. Before proceeding to the tutorial you should know something about Maven.
This project is a Maven reactor project for the NetBeans Platform application, which lists the modules to include and the location of the project’s repositories. This project does not contain any sources. The IDE generates the modules containing the sources and resources in sub-directories of this project.
What is Maven?
- Maven is distributed in several formats for your convenience. Simply pick a ready-made binary distribution archive and follow the installation instructions. Use a source archive if you intend to build Maven yourself.
- Maven IDE integration Web Site Other Useful Business Software You don’t need to hit the panic button about iOS 14. We have more engineers, more solutions, and more resources on iOS 14 and attribution than anyone.
Maven is a powerful tool for software project management and comprehension that based on Project Object Model (POM). It is used for project builds, reporting, dependency, releases, distribution, documentation and so many other things from a central place that is called POM. For more information on Maven, you can visit the following link — Maven.
What is Maven Archetype?
Maven Archetype is a Maven project templating toolkit and plugin which is used to create project structure as per the template of it. Maven provides a very large amount of different types of archetypes for different project structure. Some most popular and important archetypes are —
- maven-archetype-j2ee-simple – An archetype to generate a simplified sample J2EE application.
- maven-archetype-quickstart – An archetype to generate a sample Maven project.
- maven-archetype-webapp – An archetype to generate a sample Maven webapp project.
- maven-archetype-archetype -An archetype to generate a sample archetype project.
For more information on Maven Archetype please visit the following link — Maven Archetype. Smugdesk mesh computer ergonomic chair.
Create Maven project in Eclipse IDE
Now it is the time to see how we will create Maven project in Eclipse IDE with the help of maven-archetype-quickstart. Just follow the below the steps —
Click on File menu -> New -> Maven Project. It will open a New Maven Project window and do not change any settings of it. Just click the Next button.
Next, you will see a New Maven Project window where do not change anything for now just click on Next button.
In the next and below window box choose maven-archetype-quickstart as the default archetype. Write quickstart in the Filter box and select the quickstart archetype from the list and click Next.
When you are creating a Maven project in Eclipse IDE, you have to keep some basic knowledge in your mind such as,
Group Id: It is a unique identifier which identifies you project among all others, so we need to force a naming schema and it should follow the Java’s package name rule. This means it must start with a reversed domain name you control. For example, com.mtb.maven
Artifact Id: It is the name of jar file without any version. For example, maven_demo
Version: If you distribute it, it should have a version. You can specify any version of your own.
So, these are the basic things you have to remember when you create a Maven project in Eclipse IDE.
After filling up the necessary fields click on the Finish button.
Project structure of a Maven project in Eclipse IDE
After all the above steps a Maven project with Artifact Id “maven_demo” will be created as the below image.
As you can see in the above image the default JRE version is 1.5 although the even higher version is installed in your system. By two ways you can assign higher or installed version of JRE in this project.
- First, delete default JRE System Library [J2SE-1.5] and then add the library of installed JDK as in your system.
- Another way is you can use Maven compiler to configure JRE version.
After any changes in the project you have to update the maven project — maven_demo -> Maven -> Update Project… -> Update Maven Project dialog box will appear. Make sure that maven_demo is checked -> OK button.
Maven Ide Java
Write Java Code
Let’s write some Java code in the App.java file. The following Java code just prints some text and today’s date time in the console.
Compile, build and execute the Maven project
In order to compile, build and execute the Maven project we need another Maven plugin that is “exec-maven-plugin“. So we need to update the pom.xml file for that plugin.
Now, Right-Click on maven_demo -> Run As -> Maven Build…. After that write exec:java in the Goalsfield and press the Run button.
When you clicked on the Run button, Maven will start to build the project and after successful build the following output you will get from the console —
Maven Ide Download
If you face any problem feel free to inform me in the comment section below. Please like and share this tutorial on “How to create Maven project in Eclipse IDE” with others. Kindly subscribe Mitrajit’s Tech Blog to keep yourself updated with the upcoming article.