Appearance
Gradle Module Metadata
Gradle publishes a .module file next to the POM. It describes the component's variants: the files, dependencies, and attributes that belong to each way of consuming the component, such as its API, its runtime, its sources, and its Javadoc.
Artifex reads the file when it arrives and shows what's in it.
What a version page shows
For a version that has a module file, the page shows the following:
- The format version and what produced the file, such as Gradle and its version.
- Each variant, with its name and its attributes, such as
org.gradle.usageandorg.gradle.category. - The files of each variant, with the name, the file it points at, the size, and the SHA-256 digest that the module file declares.
- The dependencies and dependency constraints of each variant, with what each one requires, prefers, or strictly requires, the versions it rejects, and the reason if one was given.
- The capabilities that each variant provides.
- For a variant that lives somewhere else, the coordinates it's available at.
This is the fastest way to answer why a build picked one jar over another: the attributes on the variant are what Gradle matched against.
Nothing is rewritten. The file is served exactly as it was deployed, so a build resolves what your publication declared.
Fetch variant files early
A module file lists the files of every variant, so a repository that just cached one already knows which files a build is about to ask for.
Fetch variant files early on an upstream makes Artifex fetch those files as soon as a module file arrives from it, instead of waiting for a build to ask for each one. A build that then asks for a classifier gets it from the repository rather than through the upstream.
To turn it on, follow these steps:
- Open the repository and go to Upstreams.
- Open the upstream.
- Turn on Fetch variant files early.
- Click Save changes.
Consider the following before you turn it on:
- It trades storage for latency. Every file of every variant is fetched, including sources and Javadoc that your builds might never ask for.
- Files that are already in the repository aren't fetched again.
- A file that the upstream doesn't have is skipped without failing the request that brought the module file in.
The option applies to files coming from remote upstreams. Files deployed to the repository are already here, and an Artifex upstream serves its files through without copying them.
If a module file can't be read
A .module file that isn't valid Gradle Module Metadata is still stored and still served, so your build sees exactly what was published. It just isn't shown as variants on the version page.