Depending on a Plug-in

It's possible to add a plug-in dependency in your project's POM. For example, to add a dependency to the JAR plug-in version 1.7, edit your project's project.xml and add:

<dependency>
  <groupId>maven</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>1.7</version>
</dependency>

If you execute a goal in this project, and if Version 1.7 of the JAR plug-in is not installed on your system, Maven will automatically download and install it. This makes it very easy to have builds that always work, even if you can't control what users have installed on their machines. This is the strategy that we used in the samples in this book and which you can find on http://www.mavenbook.org/svn/mdn/code.

Get Maven: A Developer's Notebook 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.