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> ...

Get Mastering Apache Maven 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.