YouTip LogoYouTip

Maven Tutorial

Maven Tutorial |

-- Learning is not just about technology, but also about dreams!

Maven Tutorial

Maven Tutorial Maven Introduction Maven Environment Setup Maven First Project Maven POM Maven Build Life Cycle Maven Build Profiles Maven Common Commands Maven Dependencies Maven Multi-Module Project Maven Repositories Maven Plugins Maven Creating Java Project Maven Build & Test Project Maven External Dependencies Maven Project Templates Maven Project Documents Maven Snapshots Maven Build Automation Maven Dependency Management Maven Deployment Automation Maven Web Application Maven Eclipse Maven NetBeans Maven IntelliJ

Maven Introduction

Deep Dive

  • Web Service
  • Web Design & Development
  • Scripting Languages
  • Computer Science
  • Development Tools
  • Programming Languages
  • Software
  • Scripting
  • Programming

Maven Tutorial

Maven Logo

Maven translates to "expert" or "professional" and is an open-source project under Apache, developed purely in Java. Based on the concept of the Project Object Model (POM), Maven uses a central information snippet to manage a project's build, reporting, and documentation steps.

Maven is a project management tool that can build and manage dependencies for Java projects.

Maven can also be used to build and manage various projects, such as those written in C#, Ruby, Scala, and other languages. Maven was once a sub-project of the Jakarta Project and is now an independent Apache project hosted by the Apache Software Foundation.


Prerequisites for This Tutorial

This tutorial is primarily aimed at beginners, helping them learn the basic functions of the Maven tool. Upon completing this tutorial, your Apache Maven expertise will reach an intermediate level, after which you can proceed to learn more advanced knowledge.

To follow this tutorial, you need the following foundation: Java Basics.


Maven Features

Maven can help developers with the following tasks:

  • Build
  • Documentation generation
  • Reporting
  • Dependencies
  • SCMs
  • Release
  • Distribution
  • Mailing list

Maven Characteristics

  1. Convention over Configuration: Provides a standardized project structure and build lifecycle.
  2. Dependency Management: Automatically handles project dependencies.
  3. Plugin System: Rich plugins support various build tasks.
  4. Multi-Module Support: Simplifies the management of large projects.
  5. Central Repository: Access to globally shared library resources.

Convention Configuration

Maven advocates using a common standard directory structure. Maven follows the principle of "convention over configuration," and everyone should adhere to this directory structure as much as possible. It is shown below:

Directory Purpose
${basedir} Stores pom.xml and all subdirectories
${basedir}/src/main/java Project's Java source code
${basedir}/src/main/resources Project resources, e.g., property files, springmvc.xml
${basedir}/src/test/java Project test classes, e.g., JUnit code
${basedir}/src/test/resources Test resources
${basedir}/src/main/webapp/WEB-INF Web application file directory, web project information, e.g., storing web.xml, local images, JSP view pages
${basedir}/target Packaging output directory
${basedir}/target/classes Compiled output directory
${basedir}/target/test-classes Test compiled output directory
Test.java Maven will only automatically run test classes that follow this naming convention
~/.m2/repository Maven's default local repository directory location

← Maven Build ProfilesVuejs Ajax β†’