Learn Apache Maven to create, manage and automate Java projects

Maven is one of the most widely used open-source software programs in enterprises around the world because:

1. Standardized Directory Structure

2. Declarative Dependency Management

3. Plugins

4. Uniform Build Abstraction

5. Tools Support

6. Archetypes

7. Convention Over Configuration

Maven Components

Maven utilizes several components in order to accomplish its tasks:

Setting Up Maven

Maven Dependency Management

Dependency Identification

Transitive Dependencies

Maven Project Organization

├── pom.xml
├── src
│ ├── main
│ │ └── java
│ │ └── com
│ │ └── learncsdesign
│ │ └── App.java
│ └── test
│ └── java
│ └── com
│ └── learncsdesign
│ └── AppTest.java
└── target

Demystifying POM

Maven Coordinates



Maven provides the following six scopes:


Maven Lifecycle

Goals and Plugins

Lifecycle and Phases

Every Maven project has the following three built-in lifecycles:

Let’s look at some of the phases associated with the default life cycle.

A portion of the internal lifecycle associated with JAR project

Maven Archetype

$ mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId={maven-template} -DinteractiveMode=false
$ mvn archetype:generate -DgroupId=com.learncsdesign -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Documentation and Reporting

Using the Site Lifecycle

$ mvn site

Generating Javadoc Reports

Generating Unit Test Reports

Generating Code Coverage Reports

Maven Release Process

Maven Prepare Goal

$ mvn release:prepare

Maven Perform Goal

$ mvn release:perform




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store