private ProxyConfig getProxyConfig() { if (npmInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("npm not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
private static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) { List<String> arguments = new ArrayList<>(); if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) { arguments.add("--registry=" + npmRegistryURL); } if (!proxyConfig.isEmpty()) { Proxy proxy = null; if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) { proxy = proxyConfig.getProxyForUrl(npmRegistryURL); } if (proxy == null) { proxy = proxyConfig.getSecureProxy(); } if (proxy == null) { proxy = proxyConfig.getInsecureProxy(); } arguments.add("--https-proxy=" + proxy.getUri().toString()); arguments.add("--proxy=" + proxy.getUri().toString()); } return arguments; } }
private static List<String> buildArguments(ProxyConfig proxyConfig) { List<String> arguments = new ArrayList<String>(); if (!proxyConfig.isEmpty()) { ProxyConfig.Proxy secureProxy = proxyConfig.getSecureProxy(); if (secureProxy != null){ arguments.add("--config.https-proxy=" + secureProxy.getUri().toString()); } ProxyConfig.Proxy insecureProxy = proxyConfig.getInsecureProxy(); if (insecureProxy != null) { arguments.add("--config.proxy=" + insecureProxy.getUri().toString()); } } return arguments; } }
private CloseableHttpResponse execute(String requestUrl, String userName, String password) throws IOException { CloseableHttpResponse response; Proxy proxy = proxyConfig.getProxyForUrl(requestUrl); if (proxy != null) { LOGGER.info("Downloading via proxy " + proxy.toString()); return executeViaProxy(proxy, requestUrl); } else { LOGGER.info("No proxy was configured, downloading directly"); if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { LOGGER.info("Using credentials (" + userName + ") from settings.xml"); // Auth target host URL aURL = new URL(requestUrl); HttpClientContext localContext = makeLocalContext(aURL); CredentialsProvider credentialsProvider = makeCredentialsProvider( aURL.getHost(), aURL.getPort(), userName, password); response = buildHttpClient(credentialsProvider).execute(new HttpGet(requestUrl),localContext); } else { response = buildHttpClient(null).execute(new HttpGet(requestUrl)); } } return response; }
private ProxyConfig getProxyConfig() { if (bowerInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("bower not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
private static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) { List<String> arguments = new ArrayList<String>(); if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ arguments.add ("--registry=" + npmRegistryURL); } if(!proxyConfig.isEmpty()){ Proxy proxy = null; if(npmRegistryURL != null && !npmRegistryURL.isEmpty()){ proxy = proxyConfig.getProxyForUrl(npmRegistryURL); } if(proxy == null){ proxy = proxyConfig.getSecureProxy(); } if(proxy == null){ proxy = proxyConfig.getInsecureProxy(); } arguments.add("--https-proxy=" + proxy.getUri().toString()); arguments.add("--proxy=" + proxy.getUri().toString()); } return arguments; } }
private ProxyConfig getProxyConfig() { if (this.yarnInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(this.session, this.decrypter); } else { getLog().info("yarn not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
@Override public void configure(final Env env, final Config conf, final Binder binder) throws Throwable { Path userdir = Paths.get(System.getProperty("user.dir")); Path workDirectory = Optional.ofNullable(this.workDirectory) .orElse(userdir); Path installDirectory = Optional.ofNullable(this.installDirectory).orElse(workDirectory); ProxyConfig proxy = new ProxyConfig(proxies(conf)); CacheResolver cache = Files.exists(userdir.resolve("pom.xml")) ? new MavenCacheResolver() : null; FrontendPluginFactory factory = new FrontendPluginFactory(workDirectory.toFile(), installDirectory.toFile(), cache); installNode(conf, nodeVersion, proxy, factory); Map<String, String> environment = environment(conf); NodeTask task = newTask(factory, conf, proxy, environment, nodeVersion); onSyncPackageJson(conf, workDirectory, task::executeSync); if (onStart == null && onStarted == null) { onStart = cmd -> cmd.execute("run", "build"); } if (onStart != null) { env.onStart(() -> onStart.accept(task)); } if (onStarted != null) { env.onStarted(() -> onStarted.accept(task)); } }
static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) { if (mavenSession == null || mavenSession.getSettings() == null || mavenSession.getSettings().getProxies() == null || mavenSession.getSettings().getProxies().isEmpty()) { return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } else { final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies(); final List<ProxyConfig.Proxy> proxies = new ArrayList<ProxyConfig.Proxy>(mavenProxies.size()); for (Proxy mavenProxy : mavenProxies) { if (mavenProxy.isActive()) { mavenProxy = decryptProxy(mavenProxy, decrypter); proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts())); } } LOGGER.info("Found proxies: {}", proxies); return new ProxyConfig(proxies); } }
private ProxyConfig getProxyConfig() { if (ignoreMavenProxies) { return new ProxyConfig(Collections.emptyList()); } return new ProxyConfig(getMavenProxies().stream() .filter(Proxy::isActive) .map(proxy -> decrypter .decrypt(new DefaultSettingsDecryptionRequest(proxy))) .map(SettingsDecryptionResult::getProxy).map(this::createProxy) .collect(Collectors.toList())); }
private ProxyConfig getProxyConfig() { if (this.yarnInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(this.session, this.decrypter); } else { getLog().info("yarn not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
private ProxyConfig getProxyConfig() { if (bowerInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("bower not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
private ProxyConfig getProxyConfig() { if (npmInheritsProxyConfigFromMaven) { return MojoUtils.getProxyConfig(session, decrypter); } else { getLog().info("npm not inheriting proxy config from Maven"); return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } }
static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) { if (mavenSession == null || mavenSession.getSettings() == null || mavenSession.getSettings().getProxies() == null || mavenSession.getSettings().getProxies().isEmpty()) { return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } else { final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies(); final List<ProxyConfig.Proxy> proxies = new ArrayList<ProxyConfig.Proxy>(mavenProxies.size()); for (Proxy mavenProxy : mavenProxies) { if (mavenProxy.isActive()) { mavenProxy = decryptProxy(mavenProxy, decrypter); proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts())); } } LOGGER.info("Found proxies: {}", proxies); return new ProxyConfig(proxies); } }
public static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) { if (mavenSession == null || mavenSession.getSettings() == null || mavenSession.getSettings().getProxies() == null || mavenSession.getSettings().getProxies().isEmpty()) { return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } else { final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies(); final List<ProxyConfig.Proxy> proxies = new ArrayList<>(mavenProxies.size()); for (Proxy mavenProxy : mavenProxies) { if (mavenProxy.isActive()) { mavenProxy = decryptProxy(mavenProxy, decrypter); proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts())); } } return new ProxyConfig(proxies); } }