Package enterprises.iwakura.amber.impl
Class MavenDependencyDownloader
java.lang.Object
enterprises.iwakura.amber.impl.MavenDependencyDownloader
- All Implemented Interfaces:
DependencyDownloader
Implementation of
DependencyDownloader that downloads dependencies from any Maven repositories. Supports version overrides via
maven-metadata.xml.-
Field Summary
Fields inherited from interface enterprises.iwakura.amber.DependencyDownloader
USER_AGENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpURLConnectioncreateConnection(String url) Prepares an HTTP GET connection with the default User-Agent.downloadChecksum(Dependency dependency, Repository repository, ChecksumType checksumType) Downloads the checksum for the specified dependency from the given repository.downloadJar(Dependency dependency, Repository repository, Path filePath) Downloads the jar file for the specified dependency from the given repository and saves it to the specified file path.protected StringDownloadResultdownloadVersionOverrideFromMavenMetadata(Dependency dependency, Repository repository) Tries to download and parsemaven-metadata.xmlto find a version override for the given dependency.
-
Constructor Details
-
MavenDependencyDownloader
public MavenDependencyDownloader()
-
-
Method Details
-
downloadJar
public DownloadResult downloadJar(Dependency dependency, Repository repository, Path filePath) throws IOException Description copied from interface:DependencyDownloaderDownloads the jar file for the specified dependency from the given repository and saves it to the specified file path.- Specified by:
downloadJarin interfaceDependencyDownloader- Parameters:
dependency- the dependency to downloadrepository- the repository to download fromfilePath- the path to save the downloaded jar file- Returns:
- a
DownloadResultindicating the success or failure of the download - Throws:
IOException- if an I/O error occurs during the download
-
downloadChecksum
public StringDownloadResult downloadChecksum(Dependency dependency, Repository repository, ChecksumType checksumType) throws IOException Description copied from interface:DependencyDownloaderDownloads the checksum for the specified dependency from the given repository.- Specified by:
downloadChecksumin interfaceDependencyDownloader- Parameters:
dependency- the dependency to download the checksum forrepository- the repository to download fromchecksumType- the type of checksum to download (e.g., MD5, SHA-1, SHA-256)- Returns:
- a
StringDownloadResultcontaining the checksum string if successful, or an error message if failed - Throws:
IOException- if an I/O error occurs during the download
-
downloadVersionOverrideFromMavenMetadata
protected StringDownloadResult downloadVersionOverrideFromMavenMetadata(Dependency dependency, Repository repository) Tries to download and parsemaven-metadata.xmlto find a version override for the given dependency.- Parameters:
dependency- the dependency to check for version overriderepository- the repository to download from- Returns:
- a
StringDownloadResultcontaining the version override if found, null if not found, or an error message if failed
-
createConnection
Prepares an HTTP GET connection with the default User-Agent.- Parameters:
url- the URL to connect to- Returns:
- the prepared HttpURLConnection
- Throws:
IOException- if an I/O error occurs
-