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' } } ...

Get Gradle Dependency Management 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.