I’m using maven-publish to publish a jar to our custom Maven repository which has a dependency to another jar located at another custom Maven repository.
Here’s the maven-publish code to add repositories to the published pom:
publishing {
publications {
maven(MavenPublication) {
from project.components.java
pom.withXml {
def confluentRepo = asNode().appendNode('repositories').appendNode('repository')
confluentRepo.appendNode('id', 'confluent')
confluentRepo.appendNode('name', 'Confluent')
confluentRepo.appendNode('url', 'http://packages.confluent.io/maven/')
}
}
}
}
Here’s the generated pom:
<project>
.
.
<dependencies>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>2.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>confluent</id>
<name>Confluent</name>
<url>http://packages.confluent.io/maven/</url>
</repository>
</repositories>
</project>
But when I add this published module as a dependency to another project, gradle fails to download the jar that’s located at this custom repository.
I’m using gradle version 2.12
Any help is much appreciated.