static void downloadFile(String artifact, String src, File dest) throws IOException { if (dest.exists()){ return; } final URL url = new URL(src); final URLConnection connection = MavenSettings.getSettings().openConnection(url); boolean message = Boolean.getBoolean("maven.download.message"); try (InputStream bis = connection.getInputStream()){ dest.getParentFile().mkdirs(); if (message) { System.out.println("Downloading " + artifact); } Files.copy(bis, dest.toPath(), StandardCopyOption.REPLACE_EXISTING); } }
public static String downloadTimestampVersion(String artifact, String metadataSrc) throws IOException, XPathExpressionException { final URL url = new URL(metadataSrc); final URLConnection connection = MavenSettings.getSettings().openConnection(url); boolean message = Boolean.getBoolean("maven.download.message"); try (InputStream is = connection.getInputStream()) { if (message) { LOGGER.trace("Downloading maven-metadata.xml for " + artifact); } return snapshotVersionXpath.evaluate(new InputSource(is)); } }
public static void downloadFile(String artifact, String src, File dest) throws IOException { if (dest.exists()) { return; } final URL url = new URL(src); final URLConnection connection = MavenSettings.getSettings().openConnection(url); boolean message = Boolean.getBoolean("maven.download.message"); try (InputStream bis = connection.getInputStream()) { dest.getParentFile().mkdirs(); if (message) { LOGGER.trace("Downloading " + artifact); } Files.copy(bis, dest.toPath(), StandardCopyOption.REPLACE_EXISTING); } }
String artifactRelativePath = coordinates.relativeArtifactPath(File.separatorChar); String artifactRelativeHttpPath = coordinates.relativeArtifactPath('/'); final MavenSettings settings = MavenSettings.getSettings(); final Path localRepository = settings.getLocalRepository(); final File localRepositoryFile = localRepository.toFile();
String artifactRelativeHttpPath = coordinates.relativeArtifactPath('/'); String artifactRelativeMetadataHttpPath = coordinates.relativeMetadataPath('/'); final MavenSettings settings = MavenSettings.getSettings(); final Path localRepository = settings.getLocalRepository(); final File localRepositoryFile = localRepository.toFile();