In my previous blog I wrote about Tree Map in details. Today i am going to write about Maven.
You can find all my articles under Below:
Today i am going write about Maven build tool. We will also do an example of how can we create a simple Java Maven project using Eclipse.
- Basic knowledge of Eclipse IDE.
- Basic knowledge of Core Java.
Apache Maven is a software management tool. It has the ability to understand of building a software. It is based on the concept of POM(Project Object Model).
POM(Project Object Model): It is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details which is used to build the project.
The POM was renamed from Project.xml in Maven1 to Pom.xml in Maven2. When executing the complete project, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.
Some of the configuration that can be specified in the POM are:
- The project dependencies,
- The plugins.
- project version, description.
- Dependency management: It will resolve and manage your dependencies for you.
- Testing: It has the ability to run tests and integration tests as part of your project lifecycle.
- Plugins: If we need thousands of plugins in our project to carry out various tasks. These are simply configured in just by adding a reference into the POM.
- Maven puts you in a mindset of automating processes around your software development.
- Using your own plugin in Maven can be too much expensive.
- it is focused on Java projects.
How To Create a New Maven Project in Eclipse
We will create Maven Project using Eclipse IDE. So lets get started
- Open your Eclipse IDE.
- Go to the File(on top left of Eclipse IDE) and when you hover your cursor on new you can see many option to create a project, but you have to select “Maven Project”.
- Now you can choose to Create a simple project .For the purposes of this tutorial, we will choose the simple project.
- This will create a basic, Maven-enabled Java project. If you require a more advanced setup, leave this setting unchecked, and you will be able to use more advanced Maven project setup features. Leave other options as is, and click Next.
- In the next window, you have to filled the information regarding creating the Maven project.
- In general, the Group Id should correspond to your organization name, and the Artifact Id should correspond to the project’s name.
- As it is a demo project, it does not have parent dependencies, you can leave the Parent Project section as is. Fill out the appropriate information, and click Finish.
- You can now see that your project has been created. Below is the folder structure
- You will place your Java code in /src/main/java, resources in /src/main/resources, and your testing code and resources in /src/test/java and /src/test/resources respectively.
Congratulations! If you reach this point means you have followed all the steps correctly and you have understand about Maven.
If I missed any point or you have any doubt regarding this blog just let me know in the comment section. If you like my article please like our Facebook page and also follow us on Twitter so that you get regular updates. For regular updates you can also subscribe to hackpundit.com with your email.
Please also share on Facebook and Twitter to help other Technology geeks. Thank You..!