Mastering Apache Maven 3
eBook - ePub

Mastering Apache Maven 3

Prabath Siriwardena

Share book
  1. 298 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Apache Maven 3

Prabath Siriwardena

Book details
Book preview
Table of contents
Citations

About This Book

Maven is the number one build tool used by developers for more than a decade. Maven stands out among other build tools due to its extremely extensible architecture, which is built on top of the concept "convention over configuration". This has made Maven the de-facto tool used to manage and build Java projects.

This book is a technical guide to the difficult and complex concepts in Maven and build automation. It starts with the core Maven concepts and its architecture, and then explains how to build extensions such as plugins, archetypes, and lifecycles in depth.

This book is a step-by-step guide that shows you how to use Apache Maven in an optimal way to address your enterprise build requirements.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering Apache Maven 3 an online PDF/ePUB?
Yes, you can access Mastering Apache Maven 3 by Prabath Siriwardena in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781783983865
Edition
1

Mastering Apache Maven 3


Table of Contents

Mastering Apache Maven 3
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Apache Maven Quick Start
A quick introduction
Installing Apache Maven
Installing Apache Maven on Ubuntu
Installing Apache Maven on Mac OS X
Installing Apache Maven on Microsoft Windows
Configuring the heap size
Monitoring the build
Remote debugging
Convention over configuration
IDE integration
NetBeans integration
IntelliJ IDEA integration
Eclipse integration
Troubleshooting
Enabling Maven debug-level logs
Building dependency tree
Viewing all environment variables and system properties
Viewing the effective POM file
Viewing the dependency classpath
Summary
2. Demystifying Project Object Model
Project Object Model
The POM hierarchy
Super POM
POM extending and overriding
Maven coordinates
Parent POM file
Managing POM dependencies
Transitive dependencies
Dependency scopes
Optional dependencies
Dependency exclusion
Summary
3. Maven Configuration
Maven Wagon
Wagon HTTP(S) transport
Wagon system properties
Proxy authentication
Secured repositories
Encrypting credentials in settings.xml
Source Control Management systems
Maven with Subversion
Local repository location
Mirrored repositories
The internal corporate repository
Advanced mirror configurations
Deploying artifacts
Deploying file-based artifacts
Deploying SSH-based artifacts
Deploying FTP-based artifacts
Enabling Maven logging
Summary
4. Build Lifecycles
Standard lifecycles in Maven
The clean lifecycle
The default lifecycle
The site lifecycle
Lifecycle bindings
Building a custom lifecycle
Lifecycle extensions
Summary
5. Maven Plugins
Common Maven plugins
The clean plugin
The compiler plugin
The install plugin
The deploy plugin
The surefire plugin
The site plugin
The jar plugin
The source plugin
The resources plugin
The release plugin
Plugin discovery and execution
Plugin management
Plugin repositories
Plugin as an extension
Plexus
Maven and Dependency Injection
Google Guice
Developing custom plugins
Associating a plugin with a lifecycle
The plugin execution order
Inside the execute method
Summary
6. Maven Assemblies
The assembly plugin
The assembly descriptor
Artifact/resource filtering
Assembly help
A runnable, standalone Maven project
Summary
7. Maven Archetypes
Archetype quickstart
The batch mode
Archetype catalogues
Building an archetype catalogue
Public archetype catalogues
The anatomy of archetype-catalog.xml
The archetype plugin goals
Maven plugins with the archetype plugin
Java EE web applications with the archetype plugin
Deploying web applications to a remote Apache Tomcat server
Android mobile applications with the archetype plugin
EJB archives with the archetype plugin
JIRA plugins with the archetype plugin
Spring MVC applications with the archetype plugin
Building a custom archetype
The archetype descriptor
Generating a multimodule Maven project
archetype:create-from-project with custom properties
Summary
8. Maven Repository Management
Maven repositories
The update policy
Multiple repositories
Repositories in settings.xml
The Maven repository manager
Repository management with Nexus
Installing and running Nexus
Creating a hosted repository
Creating a proxy repository
Creating a virtual repository
Blocking selected artifacts
Inclusive and exclusive routing
Scheduled tasks
Artifact indexing
Nexus plugins
A repository metadata model
Summary
9. Best Practices
Dependency management
Defining a parent module
POM properties
Avoiding repetitive groupId and version tags and inherit from the parent POM
Following naming conventions
Maven profiles
Think twice before you write your own plugin
The Maven release plugin
The Maven enforcer plugin
Avoid using un-versioned plugins
Using exclusive and inclusive routes
Avoid having both release and snapshot repositories in the same group repository
Avoid having both proxy and hosted repositories in the same group repository
Minimizing the number of repositories
Using mirrorOf instead of changing repository URLs
Descriptive parent POM files
Documentation is your friend
Avoid overriding the default directory structure
Using SNAPSHOT versioning during development
Get rid of unused dependencies
Avoid keeping credentials in application POM files
Avoid using deprecated references
Avoid repetition – use archetypes
Avoid using maven.test.skip
Share resources – avoid duplicates
Summary
Index

Mastering Apache Maven 3

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2014
Production reference: 1221214
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-386-5
www.packtpub.com

Credits

Author
Prabath Siriwardena
Reviewers
Petri Kainulainen
Michał Kozik
Pavithra Gunasekara
Sagara Gunathunga
Bhavani P Polimetla
Commissioning Editor
Akram Hussain
Acquisition Editor
Subho Gupta
Content Development Editor
Ruchita Bhansali
Technical Editors
Shubhangi Dhamgaye
Shweta Pant
Mohita Vyas
Project Coordinator
Kranti Berde
Copy Editors
Roshni Banerjee
Deepa Nambiar
Rashmi Sawant
Proofreaders
Simran Bhogal
Mario Cecere
Lucy Rowland
Indexer
Tejal Soni
Graphics
Valentina D'silva
Abhinash Sahu
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph

About the Author

Prabath Siriwardena is the Director of Security Architecture at WSO2 Inc., a company...

Table of contents