JavaTMP Bootstrap Template Documentation Index

Java Build Automation Tool Apache Maven

Building and Managing Java and Java Spring Projects using the Java Build Tool - Apache Maven.

Why Maven ?

Objectives of Apache Maven

Development Environment Tools

Installing Maven

Installing Eclipse IDE

Installing Apache Tomcat

Setting up Apache tomcat with eclipse IDE

Setting up Maven with Eclipse IDE

Maven Plugins

Maven is a plugin execution framework, all work is done by plugins. This following page lists the core plugins and others. There are the build and the reporting plugins:

Apache Maven Clean Plugin

The Clean Plugin is used when you want to remove files generated at build-time in a project’s directory. Read more about clean plugin in the page

Apache Maven Compiler Plugin

Maven Archetype

Archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made. It is a system that provides a consistent means of generating Maven projects. Archetype will help authors create Maven project templates for users, and provides users with the means to generate parameterized versions of those project templates. -To create a new project based on an Archetype, you need to call mvn archetype:generate goal, like the following:

mvn archetype:generate ...

Creating Maven Project

<project xmlns="" xmlns:xsi=""
    │   pom.xml
        │   └───java
        │       └───com
        │           └───javatmp
        │               └───demo1

Standard Maven Directory Layout

Importing a Java Maven Project into Eclipse

Creating a New Java Maven Project in Eclipse

Importing a Java Maven Project into Eclipse IDE from GitHub

Introduction to the Maven ‘Project Object Modal’ or POM

<project xmlns="" xmlns:xsi=""

POM Packaging Types

Maven Lifecycles

mvn help:describe -Dcmd=clean
mvn help:describe -Dcmd=compile

Default or Build lifecycle

mvn install
mvn clean deploy

A Build Phase is Made Up of Plugin Goals

mvn clean dependency:copy-dependencies package

For more information about maven-dependency-plugin plugin read the page Apache Maven Dependency Plugin

Setting Up Your Project to Use the Build Lifecycle

Maven Plugins

mvn compiler:compile

Maven Plugin Configuration


Maven Javadoc Plugin

mvn javadoc:javadoc

Maven Surefire Plugin

mvn clean compiler:compile compiler:testCompile surefire:test

Or Simply Run the command which will run all the phases’ goals before it in the default lifecycle:

mvn test

Goals with Lifecycles

Site life Cycle

mvn clean install site

Customizing Maven Default Life Cycle with the Maven Compiler Plugin


Customizing Maven Default Life Cycle with the Maven Assembly Plugin

    <!-- NOTE: We don't need a groupId specification because the group is
	org.apache.maven.plugins ...which is assumed by default. -->

Introduction to Maven Dependencies