As part of the build, I want Gradle to download one of the zipped files from this website, extract it, apply some tasks to the extracted files (like the jimage
and jar
tools in the JDK), and use the result as dependencies. Because the files are not published as a standard repository and I need to do some custom work.
For now, I created a series of tasks that
- downloads the zip
- Unzips it with
Copy
- Applies the
jimage
andjar
operations withExec
- Copies the resulting artifacts to the project dir so that they can be loaded (compiletime/runtime) with
Copy
.
I’d like to know the current recommended way of accomplishing this (such as being able to declare a standard dependency with name, version, and os/arch (variant)), including being able to cache the results. In my current solution, the Exec
tasks don’t cache the results because I didn’t specify an output, but the others do.
I looked a creating a custom ivy repository with artifact transforms, but I don’t see how to match the pattern to the link. E.g.,
https://download.java.net/java/early_access/jextract/22/6/openjdk-22-jextract+6-47_linux-x64_bin.tar.gz
has the form
https://download.java.net/java/early_access/jextract/[jdkVer]/[minorVer]/openjdk-[jdkVer]-jextract+[minorVer]-[buildVer]_[osName]-[osArch]_bin.tar.gz
I’ve looked at
What is the correct way to depend on custom artifact dependencies? and some other SO questions, but a lot of info is outdated. How are these situations usually handeled?