Defining repositories

We must configure an Ivy repository to publish our configured publication. We can choose a local directory or a repository manager, such as Artifactory or Nexus.

Publishing to a local directory

If we have a directory where we want to publish our publications, we must add it to the publishing configuration block. Inside the block, we add a repositories configuration block containing one or more named repositories. For the combination of each publication and repository, Gradle creates a task with the publish<publicationName>To<repositoryName>Repository name pattern.

We define a simple directory repository in the next example build file with the name localRepo:

apply plugin: 'ivy-publish' apply plugin: 'java' version = '2.1.DEVELOPMENT' ...

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.