I'm using Gradle to publish to a local Artifactory repository. I generate 3 jars during the build: one classic jar with .class, one with javadoc (-javadoc.jar) and one with sources (-sources).
I wand to publish my binary jar and the javadoc jar to a specific repository (a public one) and the sources jar to a private repository.
How can I configure the maven-publish plugin to do that ? I've been able to define multiple repositories, but Gradle tries to push all the jars to all the repositories:
task sourcesJar(type: Zip, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Zip, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
repositories {
maven {
name "binary"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
url "http://192.168.2.167:8081/artifactory/libs-snapshot-local"
}
maven {
name "sources"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
url "http://192.168.2.167:8081/artifactory/sources-snapshot-local"
}
}
publications {
binary(MavenPublication) {
// *** I WANT TO USE THE "binary" REPOSITORY HERE ****
from components.java
artifact javadocJar
}
sources(MavenPublication) {
// *** I WANT TO USE THE "sources" REPOSITORY HERE ***
artifact sourcesJar
}
}
}
Maybe I'm missing something, but it does not seem to be possible.