What is Maven? Why should I use it?

What is Maven?

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information [1].

Why should I use it?

  • Maven is a (automated) build tools. Maven can downloads and installs required jar/library for your project that declared on pom.xml. No need to add library one by one.

How Maven Works?

Based on my comprehension, here is how Maven works.

How Maven works

  1. Developers declare required jar/library (for example: Spring, Servlet, Hibernate, etc.) on pom.xml.
  2. Developers using some libraries on their source codes.
  3. The source codes go to compiling and building phase.
  4. At the compiling and building phase, the IDE will call the Maven to build the Java project.
  5. Maven reads required library on pom.xml.
  6. Maven downloads required library from offline repository, or …
  7. Maven downloads required library from online repository.
    And then Maven will ‘install’ the library into targeted Java project.
  8. Compiling and building process will produce a Java apps (either .jar or .war).

How can I use add Maven into my project?

On Eclipse based IDE, simply choose new Maven project template to start.
If you are working with Spring MVC in Spring Tool Suite (STS), the project is automatically an Maven project.

Are there any other options?

Yes, definitely. You can choose Ant Builder [2] or Gradle [3] in favor of Maven. Both of them are also build tools.


[1] http://maven.apache.org/

[2] http://ant.apache.org/

[3] http://www.gradle.org/