MavenSettings settings = new MavenSettings(); parseSettingsXml(settingsPath, settings); if (settings.getLocalRepository() == null) { Path repository = m2.resolve("repository"); settings.setLocalRepository(repository); settings.resolveActiveSettings(); return settings; });
MavenSettings() { configureDefaults(); }
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)); } }
String localRepository = reader.nextText(); if (localRepository != null && !localRepository.trim().isEmpty()) { mavenSettings.setLocalRepository(Paths.get(interpolateVariables(localRepository))); switch (reader.getName()) { case "proxy": { parseProxy(reader, mavenSettings); break; switch (reader.getName()) { case "profile": { parseProfile(reader, mavenSettings); break; switch (reader.getName()) { case "activeProfile": { mavenSettings.addActiveProfile(reader.nextText()); break; skip(reader);
switch (reader.getName()) { case "repository": { parseRepository(reader, profile); break; skip(reader); mavenSettings.addProfile(profile);
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(); return fp.toFile(); List<String> remoteRepos = settings.getRemoteRepositories(); if (remoteRepos.isEmpty()) { return null; List<String> remoteRepos = settings.getRemoteRepositories(); if (remoteRepos.isEmpty()) { return null;
/** * Opens a connection with appropriate proxy and credentials, if required. * * @param url The URL to open. * @return The opened connection. * @throws IOException If an error occurs establishing the connection. */ public URLConnection openConnection(URL url) throws IOException { Proxy proxy = getProxyFor(url); URLConnection conn = null; if (proxy != null) { conn = url.openConnection(proxy.getProxy()); proxy.authenticate(conn); } else { conn = url.openConnection(); } return conn; }
String localRepository = reader.nextText(); if (localRepository != null && !localRepository.trim().isEmpty()) { mavenSettings.setLocalRepository(Paths.get(interpolateVariables(localRepository))); switch (reader.getName()) { case "proxy": { parseProxy(reader, mavenSettings); break; switch (reader.getName()) { case "profile": { parseProfile(reader, mavenSettings); break; switch (reader.getName()) { case "activeProfile": { mavenSettings.addActiveProfile(reader.nextText()); break; skip(reader);
switch (reader.getName()) { case "repository": { parseRepository(reader, profile); break; skip(reader); mavenSettings.addProfile(profile);
String artifactRelativeHttpPath = coordinates.relativeArtifactPath('/'); String artifactRelativeMetadataHttpPath = coordinates.relativeMetadataPath('/'); final MavenSettings settings = MavenSettings.getSettings(); final Path localRepository = settings.getLocalRepository(); final File localRepositoryFile = localRepository.toFile(); return fp.toFile(); List<String> remoteRepos = settings.getRemoteRepositories(); if (remoteRepos.isEmpty()) { return null; List<String> remoteRepos = settings.getRemoteRepositories(); if (remoteRepos.isEmpty()) { return null;
/** * Opens a connection with appropriate proxy and credentials, if required. * * @param url The URL to open. * @return The opened connection. * @throws IOException If an error occurs establishing the connection. */ public URLConnection openConnection(URL url) throws IOException { Proxy proxy = getProxyFor(url); URLConnection conn = null; if (proxy != null) { conn = url.openConnection(proxy.getProxy()); proxy.authenticate(conn); } else { conn = url.openConnection(); } return conn; }
MavenSettings settings = new MavenSettings(); parseSettingsXml(settingsPath, settings); if (settings.getLocalRepository() == null) { Path repository = m2.resolve("repository"); settings.setLocalRepository(repository); settings.resolveActiveSettings(); return settings; });
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); } }
MavenSettings() { configureDefaults(); }
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); } }