(Quick Reference)

install-dependency

Purpose

Installs a JAR dependency, making it available to Grails dependency resolution mechanism.

Examples

grails install-dependency mysql:mysql-connector-java:5.1.16
grails install-dependency mysql:mysql-connector-java:5.1.16 --dir=lib
grails install-dependency --group=mysql --name=mysql-connector-java --version=5.1.16

Description

Usage:

grails install-dependency [dependency]

Arguments:

  • group - The group of the dependency
  • name - The name of the dependency
  • version - The version of the dependency
  • repository - The repository to resolve from
  • dir - The target directory to resolve JAR files to

The install-dependency command allows the installation of a JAR dependency into the dependency cache so that it can be resolved locally (without needing to configure a repository explicitly).

In its most simple form you can pass a single argument that defines the dependency in the form "group:name:version":

grails install-dependency mysql:mysql-connector-java:5.1.16

Grails has some built in common public Maven repositories that will be used to resolve the dependency. If the dependency is not found you can specify your own repository using the repository argument:

grails install-dependency mysql:mysql-connector-java:5.1.16 \
         --repository=http://download.java.net/maven/2

By default the JARs will be resolved to your local Ivy cache (typically $USER_HOME/.ivy2/cache) when using Ivy and into your local Maven repoistory (typically $USER_HOME/.m2/repository) when using Aether, if you wish the JAR files to be placed in an alternative directory you can use the dir argument:

grails install-dependency mysql:mysql-connector-java:5.1.16 --dir=lib