Defining repositories

We must configure a Maven repository to publish our configured publication. We can choose a local directory or a repository manager, such as Artifactory or Nexus. Gradle also adds support installing the publication to our local Maven repository.

Publishing to the local Maven repository

Gradle already adds our local Maven repository as a destination for our publications. For each named publication, there is a publish<publicationName>ToMavenLocal task. Gradle also creates the publishToMavenLocal task, which will publish all publications to the local Maven repository.

We have the following example build file:

apply plugin: 'maven-publish' apply plugin: 'java' version = '2.1.DEVELOPMENT' group = 'book.gradle' repositories { jcenter() ...

Get Gradle Dependency Management now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.