Import a repository
An import copies the files of another Maven repository into an Artifex repository, so that the artifacts you published elsewhere are served from Artifex. Artifex reads the source directly; nothing passes through your computer.
You need the repository's Admin role.
Start an import
To start an import, follow these steps:
- Open the repository and go to Import.
- Click New import.
- In the Source URL field, enter the source repository's URL, such as
https://maven.example.com/releases/. - For Find the files by, select Crawl the directory listings or Use a path list.
- Optional: if the source needs authentication, expand Authentication and enter the username and password or token.
- Click Start import.
The page shows the import's progress until it's done. Builds can resolve each file as soon as it's imported.
Each file keeps the time that the source gives it: the time in the path list, or else the source's Last-Modified header. These times decide the order of versions in the Maven metadata that Artifex generates, and which version is the latest release, so they match the source.
Only one import into a repository runs at a time.
What is copied
| Source file | What the import does |
|---|---|
An artifact, a POM, a .module file, or a signature | Copies it |
A checksum file, such as .sha1 | Verifies its file against it, and doesn't copy it |
Maven metadata (maven-metadata.xml) | Skips it, because Artifex generates Maven metadata from the files |
| A file outside the Maven repository layout | Skips it |
| A file that the repository already holds | Counts it as already present, or as failed if its bytes differ |
When a file has several checksum files, the strongest one is verified: SHA-512, then SHA-256, then SHA-1, then MD5. When the checksum doesn't match, the file is fetched again. If the source sends the same bytes again, its checksum file is wrong rather than the transfer: the file is imported with a note, and Artifex serves checksums that match the bytes.
A file larger than 2 GB fails. Imported files count toward the owner's storage, but not toward requests.
To import only some groups, expand Advanced and enter Maven group IDs in Groups to import, separated by commas. Each group includes its subgroups. To see what an import would copy without copying anything, select Dry run.
Crawl the directory listings
A crawl reads the source's directory listings, starting at the source URL, and imports every file that it finds. Most repository servers serve directory listings, including Sonatype Nexus Repository 2, JFrog Artifactory, Reposilite, Apache, and nginx with autoindex.
Use a path list
When the source doesn't serve directory listings, such as an S3 bucket behind a CDN, give the import a path list: a text file with one path per line, relative to the source URL. After each path you can add the file's size in bytes, its last-modified time, or both, in that order and separated by spaces. The time is an ISO 8601 timestamp or the number of seconds since the Unix epoch. A single number of ten digits or more is read as a time.
text
# Lines that start with # are ignored.
com/example/lib/1.0/lib-1.0.jar 48213 2024-03-01T12:00:00Z
com/example/lib/1.0/lib-1.0.jar.sha1
com/example/lib/1.0/lib-1.0.pom 1203 1709294400Include the checksum files, so that the import verifies each file against them. With the size, the import also checks that each file arrived whole.
Sync again
To copy what the source gained since an import, in the import's row, click Sync again. Files that the repository already holds aren't copied again, and paths that failed are tried again. A crawl reads the source from the start; a path-list import through the API can bring a new path list.
To see why paths failed, click Failed paths in the import's row.
To move builds from the source to Artifex with no gap, sync after the last deployment to the source, and then point the builds, or the source's domain, at Artifex. For a domain, see Move a domain from another host.