Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

If you are a Java developer or a manager who has experience with Apache Maven and want to extend your knowledge, then this is the ideal book for you. Apache Maven Cookbook is for those who want to learn how Apache Maven can be used for build automation. It is also meant for those familiar with Apache Maven, but want to understand the finer nuances of Maven and solve specific problems.
Table of Contents (13 chapters)
12
Index

Manually installing dependencies that are not available in a repository


There may be situations where a library, which is not present in any Maven repository, needs to be used. We have seen one way to use it, that is, specifying it as a dependency with system scope and explicitly specifying the path to it.

The problem with this approach is that this dependency will not be available if you need to distribute your project as a library.

Maven provides a mechanism to install an artifact to your local repository so that you can declare and use it like other dependencies.

How to do it...

Use the following steps to manually install the dependencies that aren't available in a repository:

  1. Add the following dependency to the simple project that we created earlier:

    <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>apache-tomcat</artifactId>
          <version>8.0.14</version>
          <type>tar.gz</type>
          </dependency>

    The project...