Reputation: 5460
As the title says, is there a way to determine where artifacts were published in gradle's publish task? The reason being is that I'd like to have that information so I can send out an email with the URL's for downloading. Publishing isn't a problem - I've got that working through the maven-publish
. But there doesn't seem to be a way to get that information that prints out on the screen while still inside of the build.
Edit:
For example, while publishing I get a readout of
Upload http://xxxxxxxxxx:9000/archiva/repository/snapshots/com/xxxxxxxxxx/mobile/xxxxxxxxxx/0.0.1-SNAPSHOT/xxxxxxxxxx-debug-unaligned-0.0.1-SNAPSHOT.apk
The program is obviously aware of exactly where the artifact was sent. Is there a way to pull that information out and use it in another task?
Upvotes: 2
Views: 1422
Reputation: 13466
You could get this information from the task itself. The maven-publish
plugin creates a publish task per artifact per repository.
project.tasks.withType(PublishToMavenRepository).all { task ->
task.doLast {
def baseUrl = "${task.repository.url}/${task.publication.groupId.replace('.', '/')}/${task.publication.artifactId}/${task.publication.version}/${task.publication.artifactId}"
task.publication.artifacts.each { artifact ->
println "${baseUrl}${artifact.classifier ? '-' + artifact.classifier : ''}.${artifact.extension}"
}
}
}
Upvotes: 5