ArtifactUtil { public static Path download(Path directory, String gav) throws IOException { checkNotNull(directory); checkNotNull(gav); var coordinate = ParsedCoordinate.fromCoordinate(gav); String url = MAVEN_HOST + "/maven2/" + coordinate.groupId.replaceAll("\\.", "/") + "/" + coordinate.artifactId + "/" + coordinate.version + "/" + coordinate.filename; log.debug("Downloading artifact: {}", url); Path output = directory.resolve(coordinate.filename); NetUtil.download(url, output.toFile()); return output; } private  ArtifactUtil(); static Path getArtifactFile(Path directory, String coordinates); static Stream<Path> findArtifactFile(Path directory, String artifactId); static Path download(Path directory, String gav); @SuppressWarnings("deprecation") static boolean checkHash(Path directory, String gav); static String getLatestVersion(String gav);  }
@Test @DisplayName("Check download") void download_1(@TempDir Path temp) throws IOException { download(temp, "javax.measure:unit-api:1.0"); assertTrue(Files.exists(temp.resolve("unit-api-1.0.jar"))); }