Book Image

Maven Build Customization

By : Lorenzo Anardu, Roberto Baldi, Umberto Antonio Cicero, Riccardo Giomi, Giacomo Veneri
Book Image

Maven Build Customization

By: Lorenzo Anardu, Roberto Baldi, Umberto Antonio Cicero, Riccardo Giomi, Giacomo Veneri

Overview of this book

<p>Maven is one of the most popular tools used to control the dependencies and to administer a Java project. Maven can be used by newbies without the need to learn complex mechanisms, but it is also a powerful tool for big projects developed by different teams and organized over different modules and repositories.</p> <p>This book will provide you with all the information you need, right from managing dependencies to improving the build process of your organization. Starting with a simple project, you will create your development environment step-by-step, automatically build your code from resources (XML, DB), and package your JAR, WAR, and EAR files for different environments. Furthermore, you will learn about the complex hereditary features of Maven.</p> <p>Finally, this book will benefit you by teaching Maven-Gradle and Maven-Eclipse integration using the m2e plugin, managing the Maven repository from Gradle, and building a working Maven environment from Gradle.</p>
Table of Contents (17 chapters)
Maven Build Customization
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Maven build profiles


In the previous chapters, we saw how to configure the build of our project. However, we did not address the problem of build portability in the previous chapters. With build portability, we measure how easily we can port a build configuration across different environments. A nonportable build will need more configurations and hacks compared to a portable build.

Of course, portability is sometimes not entirely possible. Some plugins and some applications' configurations might depend on resources that are related to a specific environment.

In order to address such circumstances and facilitate build portability across environments, Maven introduces the concept of a build profile. A build profile is a set of POM elements that you can optionally activate by overriding the corresponding tags in a POM file. This is the only point in which you need to define environment-specific settings.

Profiles modify the POM file at build time by overriding the POM settings according to the...