Apache Maven Cookbook

Over 90 hands-on recipes to successfully build and automate development life cycle tasks following Maven conventions and best practices

Apache Maven Cookbook

Raghuram Bharathan

Over 90 hands-on recipes to successfully build and automate development life cycle tasks following Maven conventions and best practices
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785286124
Paperback272 pages

Book Description

Apache Maven offers a comprehensive set of features to build, test, release, and deploy software projects and maintain enterprise development infrastructure.

This book is a hands-on guide that enables you to explore the vast potential of Apache Maven, the leading software build tool. You will start off by successfully installing Apache Maven on your favorite OS, and then you will create your first working project. Furthermore, the book walks you through setting up and using Maven with popular Java Integrated Development Environments (IDEs) so you can exploit Maven features to build standard Java applications. Above all, you will also learn to create site reports and documentation for your project along with handling typical build requirements and other advanced Maven usages.

Table of Contents

Chapter 1: Getting Started
Introduction
Installing Maven on Microsoft Windows
Installing Maven on Mac OS X
Installing Maven on Linux
Changing the JDK used by Maven
Creating a simple project with Maven
Building a simple project with Maven
Changing the location of the Maven repository
Running Maven behind an HTTP proxy server
Understanding the standard directory layout
Chapter 2: IDE Integration with Maven
Introduction
Creating a new Maven project in Eclipse
Importing an existing Maven project in Eclipse
Creating a new Maven project in NetBeans
Importing an existing Maven project in NetBeans
Creating a new Maven project in IntelliJ IDEA
Importing an existing Maven project in IntelliJ IDEA
Chapter 3: Maven Lifecycle
Introduction
Understanding the Maven lifecycle, phases, and goals
Understanding the pom file
Understanding Maven settings
Understanding command-line options in Maven
Understanding Maven profiles
Adding a new Maven profile
Activating/deactivating a Maven profile
Using properties in Maven
Specifying source encoding for platform-independent builds
Chapter 4: Essential Maven Plugins
Introduction
Using the Maven Clean plugin
Using the Maven Compiler plugin
Changing the compiler used by the Maven Compiler plugin
Specifying the Java version for the Compiler plugin
Using the Maven Surefire plugin to run unit tests
Using the Maven Failsafe plugin to run integration tests
Using the Maven Resources plugin
Filtering using resources
Using Eclipse to run Maven goals
Using NetBeans to run Maven goals
Using IntelliJ IDEA to run Maven goals
Chapter 5: Dependency Management
Introduction
Choosing the scope of dependency
Getting a report of dependencies
Getting into dependency and avoiding dependency hell
Downloading dependencies into a folder
Understanding SNAPSHOT dependencies
Handling dependency download errors
Detecting unused/undeclared dependencies
Manually installing dependencies that are not available in a repository
Dependency management using Eclipse
Dependency management using NetBeans
Dependency management using IntelliJ IDEA
Chapter 6: Code Quality Plugins
Introduction
Analyzing code coverage with the Maven JaCoCo plugin
Analyzing code coverage with the Maven Cobertura plugin
Analyzing code with the Maven PMD plugin
Analyzing code with the Maven Checkstyle plugin
Analyzing code with the Maven FindBugs plugin
Generating source references with the Maven JXR plugin
Analyzing code with the Maven SonarQube plugin
Chapter 7: Reporting and Documentation
Introduction
Documenting with the Maven Site plugin
Generating Javadocs for a site
Generating source cross-reference for a site
Generating unit test reports for a site
Generating code coverage reports for a site
Generating code quality reports for a site
Generating selective reports
Deploying a site
Chapter 8: Handling Typical Build Requirements
Introduction
Including and excluding additional resources
Including and excluding source files and folders
Configuring Maven to search for plugins
Working in offline mode
Controlling the verbosity of the Maven output
Using the Maven Help plugin
Using the Maven SCM plugin
Generating changelogs for a site
Chapter 9: Multi-module Projects
Introduction
Understanding project inheritance
Understanding project aggregation
Combining inheritance and aggregation
Performing multi-module dependency management
Performing multi-module plugin management
Selectively building modules
Reporting for multi-module projects
Chapter 10: Java Development with Maven
Introduction
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
Chapter 11: Advanced Maven Usage
Introduction
Creating an assembly
Running a custom executable
Running an ANT task
Determining updates to Maven plugin AntRun
Determining updates to Maven dependencies
Controlling the constraints
Generating unique builds
Releasing a Maven project

What You Will Learn

  • Install Apache Maven successfully on your preferred OS
  • Explore the various features of Apache Maven to build efficient automation tools
  • Discover when and how to use the various Apache Maven plugins
  • Generate and publish your project documentation using Apache Maven
  • Analyze and control code quality and code coverage using Apache Maven
  • Build various types of Java projects as well as other binaries
  • Set up complex projects using the concept of inheritance

Authors

Table of Contents

Chapter 1: Getting Started
Introduction
Installing Maven on Microsoft Windows
Installing Maven on Mac OS X
Installing Maven on Linux
Changing the JDK used by Maven
Creating a simple project with Maven
Building a simple project with Maven
Changing the location of the Maven repository
Running Maven behind an HTTP proxy server
Understanding the standard directory layout
Chapter 2: IDE Integration with Maven
Introduction
Creating a new Maven project in Eclipse
Importing an existing Maven project in Eclipse
Creating a new Maven project in NetBeans
Importing an existing Maven project in NetBeans
Creating a new Maven project in IntelliJ IDEA
Importing an existing Maven project in IntelliJ IDEA
Chapter 3: Maven Lifecycle
Introduction
Understanding the Maven lifecycle, phases, and goals
Understanding the pom file
Understanding Maven settings
Understanding command-line options in Maven
Understanding Maven profiles
Adding a new Maven profile
Activating/deactivating a Maven profile
Using properties in Maven
Specifying source encoding for platform-independent builds
Chapter 4: Essential Maven Plugins
Introduction
Using the Maven Clean plugin
Using the Maven Compiler plugin
Changing the compiler used by the Maven Compiler plugin
Specifying the Java version for the Compiler plugin
Using the Maven Surefire plugin to run unit tests
Using the Maven Failsafe plugin to run integration tests
Using the Maven Resources plugin
Filtering using resources
Using Eclipse to run Maven goals
Using NetBeans to run Maven goals
Using IntelliJ IDEA to run Maven goals
Chapter 5: Dependency Management
Introduction
Choosing the scope of dependency
Getting a report of dependencies
Getting into dependency and avoiding dependency hell
Downloading dependencies into a folder
Understanding SNAPSHOT dependencies
Handling dependency download errors
Detecting unused/undeclared dependencies
Manually installing dependencies that are not available in a repository
Dependency management using Eclipse
Dependency management using NetBeans
Dependency management using IntelliJ IDEA
Chapter 6: Code Quality Plugins
Introduction
Analyzing code coverage with the Maven JaCoCo plugin
Analyzing code coverage with the Maven Cobertura plugin
Analyzing code with the Maven PMD plugin
Analyzing code with the Maven Checkstyle plugin
Analyzing code with the Maven FindBugs plugin
Generating source references with the Maven JXR plugin
Analyzing code with the Maven SonarQube plugin
Chapter 7: Reporting and Documentation
Introduction
Documenting with the Maven Site plugin
Generating Javadocs for a site
Generating source cross-reference for a site
Generating unit test reports for a site
Generating code coverage reports for a site
Generating code quality reports for a site
Generating selective reports
Deploying a site
Chapter 8: Handling Typical Build Requirements
Introduction
Including and excluding additional resources
Including and excluding source files and folders
Configuring Maven to search for plugins
Working in offline mode
Controlling the verbosity of the Maven output
Using the Maven Help plugin
Using the Maven SCM plugin
Generating changelogs for a site
Chapter 9: Multi-module Projects
Introduction
Understanding project inheritance
Understanding project aggregation
Combining inheritance and aggregation
Performing multi-module dependency management
Performing multi-module plugin management
Selectively building modules
Reporting for multi-module projects
Chapter 10: Java Development with Maven
Introduction
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
Chapter 11: Advanced Maven Usage
Introduction
Creating an assembly
Running a custom executable
Running an ANT task
Determining updates to Maven plugin AntRun
Determining updates to Maven dependencies
Controlling the constraints
Generating unique builds
Releasing a Maven project

Book Details

ISBN 139781785286124
Paperback272 pages
Read More

Read More Reviews

Recommended for You

Mastering Concurrency Programming with Java 8 Book Cover
Mastering Concurrency Programming with Java 8
$ 43.99
$ 30.80
DevOps Automation Cookbook Book Cover
DevOps Automation Cookbook
$ 35.99
$ 25.20
Machine Learning with Spark Book Cover
Machine Learning with Spark
$ 29.99
$ 3.00
Object-Oriented JavaScript - Second Edition Book Cover
Object-Oriented JavaScript - Second Edition
$ 29.99
$ 21.00
Learning Docker Book Cover
Learning Docker
$ 39.99
$ 8.00
RESTful Java Web Services - Second Edition Book Cover
RESTful Java Web Services - Second Edition
$ 35.99
$ 25.20