- It is a complete project management tool.
- It makes the build process very easy(No need to write long scripts) compared to ANT(old build tool used before maven)
- It has a remote maven repo which has all the dependencies in one place.
- Can be used with other programming languages too, just not java.
- It also support parallel build feature in multi core machine for large multi module projects
- It provides a uniform build system. It has a standard directory structure which is followed.
- It follows Convention over Configuration.
Example Why we use Maven instead of old way:
by Hussain Poonawala on article
- Building the old way, Let’s consider we have to build a web application. We might have several dependencies such as Web MVC, j units, etc.
- We need to manage all the dependencies, build WAR files, deploy, etc. All these steps take a lot of time.
- Let us consider an example:
We have two files: App.java and AppTest.java along with 2 jar files for writing JUnits.
- We first need to compile App.java -> App.class
- Then we need to compile AppTest.java → AppTest.class
- Then we need to run the test cases and check if no tests are failing.
- Then combine/package all classes to jar file:
- As you can see, the steps are quite tedious and difficult to follow along, and if you have a huge project with a lot of dependencies to manage it becomes almost impossible.
- Developers used ANT before to solve and automate the above process, but for this, we had to write the long scripts. Maven came in as a solution for this.
- Using maven with simple commands we can build the projects