Cannot run build with --offline after attempting build with a broken repository


(jonathan_imperial) #1

Last week, the maven repository we use for snapshots went down due to a hardware failure. Unfortunately, it went down late at night and the morning after some of our developers tried to build. Since the ttl was up, gradle tried to download the new artifacts but was unable to reach the nexus repository. Once the build had failed, they tried to build using --offline but were unable to build as gradle complained about not having the artifact, despite the artifact sitting in the filestore. After some more testing, it seems that gradle keeps metadata information in another directory and will invalidate the file in the filestore before checking to see if it can access the repository. Thus, when trying to build offline, gradle will complain about not having the artifact.

Is this the desired behavior or do we have the configuration of the repository wrong? Is there a workaround to this other than setting the snapshot ttl to a long time and only grabbing the latest dependencies with --refresh-dependencies?

We currently set the ttl to 30 minutes for snapshot dependencies and are running with gradle 1.0 with linux and windows machines.


#2

You’re correct: Gradle is removing the reference to an expired cached artifact prior to the attempt to reach the repository. So if the repository is not accessible, you are not able to recover by switching to running your build with ‘–offline’.

This is not the behaviour we would want; it would be better if we waited until we successfully resolved the latest artifact before expiring the current cache entry. I can’t think of any workaround once the cache entry has been removed.

I’ve raised GRADLE-2364 to track this.


(jonathan_imperial) #3

Awesome, thank you very much.