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

Developing a new plugin


For the development of a Java Maven plugin, we will use the same tool chain we presented in Chapter 1, Maven and Its Philosophy.

Using Eclipse's utility, we can create a new project with Maven archetype. So, we obtain a skeleton for the new Maven plugin project. This is a good starting point for our project. Perform the following steps:

  1. First of all, we will create a new Eclipse project as a new Maven project from the menu, as shown in the following screenshot:

  2. Then, we can choose the location for our project and click on Next:

  3. Now, we have to select the artifact type for our project. First, we choose Nexus Indexer, then we select maven-archetype-plugin, as shown in the following screenshot, and then click on Next:

  4. The last step in the creation procedure is the selection of the project's coordinates, as shown in the following screenshot:

The encouraged naming convention for artifactId is <ourplugin>-maven-plugin.

Tip

The name pattern, maven-<pluginname>-plugin...