Hello,
I’m trying to manage dependencies in a project built with Gradle using Nix in order to make our build process more unified and fully deterministic. Nix is a package manager for Unix systems that “makes package management reliable and reproducible”, and is configured in a declarative way using a Haskell-like language.
Currently we have a set of very ugly scripts which assemble a list of Gradle project dependencies in a Nix consumable format.
In simple terms it does this:
- Collect list of projects using
gradle projects
-
Iterate through the projects and get their dependencies using
gradle ${project}:buildEnvironment
andgradle ${project}:dependencies
- Iterate through the dependencies and try to fetch them.
- Fetch POM file for each dependency and try to download it’s dependencies
This process generates two files:
The Nix format includes SHAs for JARs and POM files and URLs for downloading them, which allows Nix to fetch them in a deterministic way.
As you can see this process is extremely heavy and takes over 90 minutes. I’m trying to figure out how I could achieve the same in a simpler way.
Is there some Gradle command or set of commands I could use to:
- Get the full list of dependencies of a project?
- Get the URL of JAR and POM Gradle would use to download it?