We are using Gradle in a big way throughout our organization. Our system is complex and is composed of many products that have their own individual source repositories and builds. Some use Maven, others Gradle to be built but they interdepend. We have products that bundle other products in their builds. All of this is actively developed and the build system is constantly churning out new versions of artifacts from each, some hundreds of megabytes or gigabytes in size.
It is those large ones that present a problem. What I am about to describe is not technically a Gradle issue but seems to be a fact of life that nothing else can deal with it and we have to do something about it in our Gradle scripts. Specifically, when a large artifact is just built, its upload to our corporate maven-type repository begins.While this is happening, and before the upload process is complete, it seems that the repository advertises its existence already.When a gradle build (of another product) that depends on the newest version of that artifact begins at this time, while the upload is still ongoing, it sees it, attempts to download it… and fails:
10:50:00 10:50:00.964 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:50:00 10:50:00.965 [ERROR] [org.gradle.BuildExceptionReporter]
10:50:00 10:50:00.965 [ERROR] [org.gradle.BuildExceptionReporter] * Where:
10:50:00 10:50:00.965 [ERROR] [org.gradle.BuildExceptionReporter] Build file 'C:\<removed>\build.gradle' line: <removed>
10:50:00 10:50:00.965 [ERROR] [org.gradle.BuildExceptionReporter]
10:50:00 10:50:00.965 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
10:50:00 10:50:00.966 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project '<removed>'.
10:50:00 10:50:00.966 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find <removed> (<removed>:<removed>:<removed>-SNAPSHOT).
10:50:00 10:50:00.966 [ERROR] [org.gradle.BuildExceptionReporter] Searched in the following locations:
10:50:00 10:50:00.966 [ERROR] [org.gradle.BuildExceptionReporter] http://<removed>/<removed>/<removed>-SNAPSHOT/<removed>-20150807.144625-530.<removed>
10:50:00 10:50:00.967 [ERROR] [org.gradle.BuildExceptionReporter]
10:50:00 10:50:00.967 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
10:50:00 10:50:00.968 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating root project '<removed>'.
If we wait for the upload to complete and rerun the build all is fine (unless another upload starts meanwhile).
Is there something (easy) we can do? The only thing that comes to mind is trying to depend on something else and short that we know will be uploaded after and, then, based on that form a dependency, but this results in complex scripts that are not easy to follow and maintain by everyone. We can’t serialize all our builds and make them sequential just to avoid this situation. We have a farm of build servers that need to be able to work at the same time and use what is out there.
Is there something that can be done in Gradle itself to recognize this case and deal with it?
Thanks!