Chapter 10. Java Development with Maven

In this chapter, we will cover the following recipes:

  • Building a JAR project
  • Generating an executable JAR
  • Generating a JAR of the source code
  • Generating a JAR of the test classes
  • Building a WAR project
  • Building an EAR project
  • Building a pom project
  • Running a web project with Jetty
  • Running a web project with Tomcat

Introduction

Maven is primarily a build tool for Java projects. Java projects can generate different types of binaries. Typically, the output of a Java project is a JAR file. For web applications, Java classes combined with other type of files result in a WAR or EAR file as well. Maven provides plugins and lifecycle phases to generate various types of binary artifacts for Java projects.

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.