What Is Maven? Purpose, Advantages and Disadvantages - Quiz

Total: 5 questions

1. 

What is Maven, and what does the convention over configuration principle mean?

Maven (Apache Maven) is a build automation and dependency management tool for Java projects. It downloads libraries, compiles the code, runs the tests, packages the result into a jar or war file and generates documentation. The project is described declaratively in pom.xml: you state what you want to get, and Maven knows how. For a standard Java project, a single command such as mvn package usually works the same on Windows, Linux and macOS, without platform-specific bat/sh scripts.

Convention over configuration means that if the project follows the standard layout, almost nothing has to be configured: source code goes in src/main/java, resources in src/main/resources, tests in src/test/java, and Maven puts the build output in target. Directories and some other settings are inherited from the built-in Super POM; if packaging is not specified, jar is used, and the default plugin bindings to phases are determined by the packaging type.

Maven is neither a framework nor a library: it does not end up in the application jar. It is developed by the Apache Software Foundation; the first stable version, Maven 1.0, was released in 2004.

2. 

What is Maven used for?

Maven covers the whole path from source code to a finished artifact: downloading libraries, compiling, running tests, packaging into a jar or war, installing into the local repository, publishing and generating reports. These are separate commands: mvn package creates the package, mvn install installs it into the local repository, mvn deploy publishes it to a remote repository, and the site with reports is built by the separate site lifecycle.

  • Dependency management - libraries and their own (transitive) dependencies are downloaded automatically using the coordinates in pom.xml.
  • A uniform build process - mvn test or mvn package works in any Maven project.
  • A standard project layout - in someone else's project you immediately know where the code, resources and tests are.
  • CI automation - Jenkins, GitHub Actions and GitLab CI run exactly the same command as the developer.
  • Reports and quality checks - Javadoc, test coverage and static analysis are added through plugins.
  • Multi-module projects - an aggregator pom.xml (packaging set to pom plus a modules list) builds related modules, and the reactor works out the build order; it is often also the parent POM, but it does not have to be.
3. 

What do the key Maven concepts mean: POM, artifact, GAV coordinates, repository, dependency, lifecycle and plugin?

  • POM (Project Object Model) - the project description in pom.xml: coordinates, dependencies, plugins, build settings.
  • Artifact - a file identified by Maven coordinates that can be resolved from a repository, installed or published: a jar, war, pom, sources archive or Javadoc.
  • GAV coordinates - the triple groupId, artifactId, version - the main address of an artifact (a specific file is further distinguished by its extension and classifier), e.g. com.google.code.gson:gson:2.11.0.
  • Repository - storage for artifacts: local (~/.m2/repository), central (Maven Central) or corporate.
  • Dependency - a third-party library declared in pom.xml by its GAV coordinates.
  • Lifecycle - an ordered sequence of build phases (compile → test → package → install); running a phase also runs all the earlier phases of the same lifecycle.
  • Plugin - a module that does the actual work; phases only invoke plugin goals.

Maven itself can do almost nothing: compilation is done by maven-compiler-plugin, tests by maven-surefire-plugin, packaging by maven-jar-plugin when packaging is jar.

4. 

What is the Maven Wrapper (mvnw), and why use it?

The Maven Wrapper pins one Maven version for the whole team. The command mvn wrapper:wrapper (it needs Maven to be installed already) adds the mvnw and mvnw.cmd scripts and the .mvn/wrapper/maven-wrapper.properties file with the Maven version to the project.

From then on the project is built with ./mvnw package (on Windows, mvnw.cmd package): the required Maven version is downloaded automatically, so there is no need to install Maven by hand. The scripts and the .mvn directory are committed to Git, so the CI server and every developer build the project with the same Maven version. The Wrapper does not pin the JDK: the required Java still has to be installed on the machine.

As of November 2026, the recommended version is Maven 3.10.0, and the previous supported line is 3.9.x (latest release 3.9.16); both require JDK 8 or newer to run, while the Java version used to compile the project is set in pom.xml.

5. 

What are the advantages and disadvantages of Maven, and when should you choose it over Gradle?

Advantages: builds that are portable across operating systems for a standard Java project; automatic dependency management with version conflict resolution (the version closest to the project in the tree wins - "nearest wins"); one-command builds from the command line and on CI; integration with IntelliJ IDEA, Eclipse and VS Code; a declarative POM; the huge Maven Central repository; a large number of plugins; uniform conventions across projects.

Disadvantages: a learning curve; hidden behavior caused by the Super POM and default plugin bindings (mvn help:effective-pom shows the final configuration); too many plugins of varying quality; hard troubleshooting (the -e and -X flags help); internet access or your own repository is required; verbose XML; limited flexibility for non-standard build logic.

Choosing: Maven fits when the project follows the standard "compile, test, package" flow and predictability and consistency matter. Gradle often wins in large multi-module projects where the speed of repeated builds is critical, and in Android development. For a beginner, Maven is a sensible start: Gradle reuses its terminology (GAV, scope, repositories).

Page 1 of 1