Gradle-publish, PublicationToMavenRepository does not declare outputs

(Michael Newcomb) #1

Creating some tasks to publish some zip artifacts to a repository. I zip up a directory and then publish the artifact. If I run the build multiple times, the zip task detects that nothing has changed and skips the task. However, if i delete the build directory (forcing the zip task to execute) the PublicationToMavenRepository always pushes up the artifact even though it did not change.

Is there a way to check the hash in the repository against a local hash to determine if an upload is required?

(Benjamin Muschko) #2

You’d have to implement some custom logic for that check but it’s certainly possible. Commercial binary repository products usually expose some sort of HTTP-based API. You can query that API and ask for the hash. The actual up-to-date checking could be implemented via Task.getOutputs().upToDateWhen(Closure).