[GRADLE-1768] Cache the result of "apply from:" when the target is a url to allow offline builds Created: 26/Aug/11  Updated: 08/Feb/17  Resolved: 08/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Chris Beams Assignee: Unassigned
Resolution: Duplicate Votes: 21


 Description   

Example: if I use the following directive

apply from: 'https://raw.github.com/cbeams/gradleplugins/0.9-upgrade/aspectjPlugin/aspectJ.gradle'

I will no longer be able to execute builds offline:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/cbeams/Work/spring-framework/spring-framework/build.gradle' line: 341

* What went wrong:
A problem occurred evaluating root project 'spring-framework'.
Cause: Could not read script 'https://raw.github.com/cbeams/gradleplugins/0.9-upgrade/aspectjPlugin/aspectJ.gradle'.
Cause: raw.github.com

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

It would make a lot of sense to:
1) cache the result of apply from: URL on first successful download and record a checksum (or ETag information if available in the HTTP response)
2) on subsequent builds, if the network is available, attempt the download again and compare checksums (or optimize for ETag if possible). If the network is not available, simply use the cached version of the script.



 Comments   
Comment by Russel Winder [ 28/Sep/11 ]

The ability to work offline — having worked online previously to capture a cache of things — should be deemed critical to usability. This issue should therefore be raised from "Major" to "Blocker" for any release of 1.0.

Comment by Gautam Korlam [ 17/Nov/14 ]

I made a plugin to make this possible now: https://github.com/kageiit/gradle-url-cache-plugin

Comment by Louis-Gabriel ZAITI [ 18/Jan/16 ]

Hi!

Is there any good news on this ?
I've been waiting traveling around, it would be really nice to build fully offline.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 08/Feb/17 ]

We already received a pull request for this feature. It's currently under review: https://github.com/gradle/gradle/pull/1022. Please follow along for any updates.

Generated at Wed Jun 30 12:03:51 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.