Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
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...