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.
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' group = 'book.gradle' repositories { jcenter() } dependencies { compile 'org.springframework:spring-context:4.1.4.RELEASE' } publishing { publications { publishJar(IvyPublication) { module = 'sample' ...