Book Image

Gradle Dependency Management

By : Hubert Klein Ikkink
Book Image

Gradle Dependency Management

By: Hubert Klein Ikkink

Overview of this book

Table of Contents (14 chapters)
Gradle Dependency Management
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using different protocols


The Maven and Ivy repositories can be accessed via several protocols. We already learned that we can use the http and https protocols. However, we can also use the file and sftp protocols. We must provide credentials when we use the sftp protocol. The file protocol doesn't support authentication.

The next example build file will use the file and sftp protocols to define the Maven and Ivy repositories:

repositories {
  ivy {
    // Use file protocol, for example an
    // accessible network share or local directory.
    url 'file://Volumes/shared/developers/repo'
  }

  maven {
    url 'sftp://ourcompany.com:22/repo'

    // With the sftp protocol we must provide
    // the username and password.
    credentials {
      username 'developer'
      password 'secret'
    }
  }
}