What is Maven and why it is used?



Maven is a build automation tool used primarily for Java projects.

In Yiddish, the word maven means “accumulator of knowledge”. 

Maven addresses two aspects of building software:

1. It describes how software is built, and (see below file structure in pic)
2. It describes its dependencies. (pom.xml)

Maven works as:

1. Build tool, and
2. Project Management Tool


Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.

Other build tools for java – Ant, Gradle.

Examples of popular IDEs supporting development with Maven include:

  • Eclipse
  • NetBeans
  • IntelliJ IDEA
  • JBuilder
  • JDeveloper (version 11.1.2)
  • MyEclipse

directory structure of a normal Maven project has the following directory entries:

Directory namePurpose
project homeContains the pom.xml and all subdirectories.
src/main/javaContains the deliverable Java source code for the project.
src/main/resourcesContains the deliverable resources for the project, such as property files.
src/test/javaContains the testing Java source code (JUnit or TestNG test cases, for example) for the project.
src/test/resourcesContains resources necessary for testing.

 

maven Project structure
Maven Project structure