Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Plugin discovery and execution


To associate a plugin with your Maven project, either you have to define it explicitly from your application POM file, or you should inherit from a parent POM or the super POM file. Let's have a look at the Maven jar plugin. The jar plugin is defined by the super POM file, and all the Maven projects inherit it. To define a plugin (which is not inherited from the POM hierarchy) or associate a plugin with your Maven project, you must add the plugin configuration under the build/plugins/plugin element. In this way, you can associate any number of plugins with your project, shown as follows:

<project>
...   
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal...