Download zip via curl/wget

Raising this again rather than necroposting. Workarounds in old posts don’t seem to work any more.
Moderately incredulous that in the era of CI builds via docker, there doesn’t seem to be a simple way of incorporating Gradle into a docker image other than by manually downloading the zip file.
Yes, I suppose I can install SDKMan. But if it is possible to download and install SDKMan via CURL and a well-known URL, why should not this also be possible for Gradle?

Can you elaborate on what you are actually talking about?`
What do you try to do and what does not work?
If what you mean is downloading a Gradle distribution using curl or wget, why should this not work and need something manual?

I mean that the official download link: https://gradle.org/next-steps/?version=8.5&format=bin has a javascript redirect so won’t work from the command line.

The backup manual link is full of trash: https://services.gradle.org/distributions/gradle-8.5-bin.zip?_gl=1*18gs0yd*_ga*MTcyMTY5ODM5Mi4xNzA2MzAyMjI1*_ga_7W7NC6YNPT*MTcwNjcxNjkzNi44LjEuMTcwNjcxNjk5NS4xLjAuMA.. and is actually also an HTTP redirect.

Now, [embarassed] I actually typed curl -l rather than curl -L and thus the ‘manual link’ did not work for me from the command line. Due to the extra query params I assumed this was intentional (e.g. the download was dependent on some cookie) rather than looking further for my own mistake.

Even better, you can strip the query params from the URL and it still works.

For folks like me that care much more about CI pipelines than IDE integration or local builds, it would be really helpful if the curl-friendly URI was actually mentioned in the installation instructions rather than leaving us to work it out for ourselves…

I mean that the official download link: https://gradle.org/next-steps/?version=8.5&format=bin has a javascript redirect so won’t work from the command line.

Well, it is not “the official download link” for tool usage.
It is a website intended for human consumption in a browser.

The backup manual link is full of trash: https://services.gradle.org/distributions/gradle-8.5-bin.zip?_gl=1*18gs0yd*_ga*MTcyMTY5ODM5Mi4xNzA2MzAyMjI1*_ga_7W7NC6YNPT*MTcwNjcxNjkzNi44LjEuMTcwNjcxNjk5NS4xLjAuMA..

That’s just some tracking information, depending on how you made it to that page.
If you directly went to the https://gradle.org/next-steps/?version=8.5&format=bin you mentioned, the “trash” is not there, only if you already opened that link with the tracking trash. But just remove it.

and is actually also an HTTP redirect.

What is the problem with HTTP redirects? They are quite common and any sane tool should support them, especially while staying within the same protocol.wget and curl which you mentioned do.

You can also get all pure download links from https://services.gradle.org/, for example from Gradle Distributions or https://services.gradle.org/versions/all.

Granted, these are not too discoverable if you don’t know about them.

If you really are concerned about the links with tracking information if you are coming from some tracked page already, I suggest you open an issue about it. This is a community forum. :slight_smile: